Skip to main content

Module stream

Module stream 

Source
Expand description

Lazy, cursor-based query result streams.

Today Session::execute drains the entire operator pipeline into a QueryResult { rows: Vec<Vec<Value>> } before returning. For large result sets this either exhausts memory or forces the caller to wait until the final row has been produced before they can see the first one.

ResultStream exposes the pipeline lazily: the consumer pulls one DataChunk (up to 2048 rows) at a time from the root operator. Dropping the stream releases the operator tree and decrements the owning session’s active_streams counter.

§Stability: Experimental

This module is new in 0.5.40. Signatures may change before being promoted to Beta. Use from embedded callers that want first-row latency or bounded memory; use Session::execute when you want a fully materialized result.

Structs§

OwnedResultStream
Binding-friendly result stream with no lifetime parameter.
OwnedRowIterator
Row-level iterator over an OwnedResultStream.
ResultStream
Lazy, chunk-based result stream bound to a session’s lifetime.
RowIterator
Row-level iterator adapter over a ResultStream.