db icon indicating copy to clipboard operation
db copied to clipboard

Needs to refactor `Query::each()`

Open Tigrov opened this issue 1 year ago • 0 comments

Query::each() returns data reader to get data row by row.

foreach ($query->each() as $row) {}

Current realization of the data reader reads batch of rows then read each row from the rows.

https://github.com/yiisoft/db/blob/e380ae2ffb6f3a466e6f168fafa93548e50f0d8c/src/Query/BatchQueryResult.php#L70-L85

If read the result of query row by row (instead of batch of rows), this will be more efficient and will use less memory.

Tigrov avatar Apr 16 '24 15:04 Tigrov