asStream

abstract fun asStream(fetchSize: Int = 100): StreamingTerminalMethods

Switches the builder to streaming mode, optimal for large datasets. Requires using streaming-specific terminal methods like forEachRow(). REQUIRES ACTIVE TRANSACTION. This method must be called inside a DataAccess.transaction { ... } block. Otherwise, PostgreSQL will ignore fetchSize and load everything into RAM.

Return

New builder instance with streaming methods.

Parameters

fetchSize

Number of rows fetched from the database in one batch. Crucial for avoiding loading the entire result into memory.