Large Result Not Chunked (ARCH3062)
Key typescript.orm.large-result-not-chunked · Severity info · Category orm
Loading an entire large result set into memory and iterating it can hold millions of rows in RAM at once. When a streaming/chunked cursor API exists, use it.
Incorrect
Section titled “Incorrect”const all = await eventRepo.find(); // millions of rows into memoryfor (const e of all) { await process(e);}Correct
Section titled “Correct”const stream = await eventRepo.createQueryBuilder('e').stream();for await (const e of stream) { await process(e);}Process large sets with a chunked cursor API such as stream/chunk/find_each.