Skip to main content
The Jiayifangyuan Journal

Enterprise blog

Engineering · Published July 25, 2026

Why Report Exports Are So Slow

Freezing the browser while exporting a hundred thousand rows is rarely a file-writing problem. It is about queries and memory.

In any admin system, export is the feature people complain about. Users click and watch a spinner for a minute, sometimes until the request times out. We have optimised over a dozen exports and the causes cluster in three places.

Three typical causes

Loading everything into memory at once. A hundred thousand rows across twenty columns becomes hundreds of megabytes once materialised.

Querying inside a loop. Each row hits a related table, so ten thousand rows means ten thousand queries.

Synchronous export. The request stays open while the file builds, the gateway times out, and the work continues invisibly in the background.

How we rebuild it

Stream the output: query and write in chunks so memory stays bounded.

Batch-load related data up front and join it in memory instead of per row.

For large files, switch to an async job: return a task id immediately and notify the user when the file is ready.

Export looks trivial but tests queries, memory and UX at once. Making it solid noticeably raises trust in the whole backend.

Back to blog

Want to apply these ideas to your project?

We are happy to go deeper into implementation details, or to discuss the specific questions you are facing.

Start a conversation →
— The editors at JiayifangyuanEST. 2019 · JYFY