After a query executes, FiQueLa wraps the results in one of two provider classes:Documentation Index
Fetch the complete documentation index at: https://docs.fiquela.io/llms.txt
Use this file to discover all available pages before exploring further.
FQL\Results\Stream— a lazy generator that reads and processes rows on demand, without buffering the full result set.FQL\Results\InMemory— anArrayIteratorthat holds all result rows in memory at once.
ResultsProvider interface, so fetchAll(), fetch(), count(), and all other result methods work identically on either type.
Automatic selection
When you call$query->execute() without arguments, FiQueLa selects the result mode automatically:
| Query contains | Result mode |
|---|---|
No ORDER BY, no JOIN | Results\Stream |
ORDER BY | Results\InMemory |
Any JOIN | Results\InMemory |
ORDER BY and JOIN | Results\InMemory |
JOIN and ORDER BY always require loading data into memory. Joining builds an in-memory hash map of the right-hand table, and sorting must buffer the full result set before it can determine the correct order. Queries that use neither operation can stream results row by row.Explicit selection
You can override the automatic choice by passing the desired class toexecute():
Comparing the two modes
Results\Stream
Results\Stream is a generator-based pipeline. Rows flow through each query phase (WHERE filter, SELECT projection, HAVING filter, LIMIT) one at a time. Memory usage stays low and roughly constant regardless of file size.
LIMIT early — it stops reading from the source file as soon as enough rows have been produced, which avoids scanning the entire file unnecessarily.
Results\InMemory
Results\InMemory stores all result rows in an ArrayIterator. Once populated it can be iterated any number of times without re-executing the query, and random access by offset is O(1).
Performance considerations
| Factor | Results\Stream | Results\InMemory |
|---|---|---|
| Memory usage | Low, constant | Proportional to result set size |
| Re-iteration | Re-executes the query | Free — data already buffered |
ORDER BY | Not supported directly | Required — buffers all rows to sort |
JOIN | Not supported directly | Required — builds hash map in memory |
LIMIT without sort | Applied in stream (fast) | Applied after buffering |
| Large files | Recommended | Use with caution |