Exporting Eloquent relations without N+1 in a streaming export
aVadim
•
13.09.2026
•
Streaming export with cursor() keeps memory flat, but touching a model's relations inside the export triggers N+1 — thousands of extra queries. Here is why cursor() cannot help with relations and how to export them through lazy() without giving up the memory savings.