Skip to content

all shifts report

notes

A first ‘conversion’ was made to convert the report from a set of eloquent-based query-builder and programmatic result building to a raw SQL query.
At the time, hitting 12000 shifts in a report was causing the browser to time out after 30+ seconds. Raw SQL brought this down to a couple of seconds.

Second conversion (sep 2020) converted the result from an array of all rows to an iterable LazyCollection.
The CSV writer consumes the iterator, and streams out from that, saving memory, and increasing speed. The output is now at 27000 shifts, and was hitting memory limits during execution, hence the LazyCollection approach.

Future plan would be to hook the iterator/collection up to an excel output package like laravel-excel. However, trying to focus on other higher priority issues at this point, and the LazyCollection approach gets us past
the memory issue.