pub const SCAN_BATCH: usize = 10_000;Expand description
Default encoded rows pulled per scan RPC when filling a Slice — a
pacing policy, not a wire bound, and deliberately not tied to any
other constant. It must stay AT MOST both of its two ceilings
(compile-time asserts in join_chunks.rs enforce <=; the value
sits strictly below both so the legality properties are margins, not
boundary coincidences):
waratah_stats::PUSHDOWN_TERMS_LIMIT(24,576) — the first EXISTS probe page broadcasts its key list UNCONDITIONALLY (cheap forLIMIT 1, no measurement gate), which is only within the terms budget while a page ofNrows holds at mostNdistinct keys; staying strictly below the limit keeps that legality a margin property, not a boundary property. Raising past the limit requires giving that first page a measurement gate or chunked delivery first.MAX_UNARY_SCAN_QUADS(the derived unary ceiling, 29,330) — the direct-unary exceptions (path windows, the detached prefetch threshold) page at this size and bypassfetch_window’s own ceiling check.
The value is retunable on its own (candidates to sweep under load: 12,000 / 15,000); larger pages amortize per-request overhead for hintless classic consumers at the cost of proportionally larger working batches through every operator above.
Used by: the OpenNode pull loop’s page demand, the detached
prefetch threshold in
crate::clients::HexastoreScan::scan_pattern_detached (demands at or
under this take one unary message, larger ones open the storage-driven
stream), and the batched pull loop’s unary-vs-scan_stream_drain_n
check.
Changing it affects: compute-side page demand, the window sizes of
the direct-unary exceptions (path windows on scan_page_at, the
detached GROUP BY prefetch threshold), and compute-side page memory.
It does not decide any transport by itself: window producers route
through fetch_window, which compares the demand against
MAX_UNARY_SCAN_QUADS itself. The one-directional dependency: keep
SCAN_BATCH <= MAX_UNARY_SCAN_QUADS so the direct-unary exceptions’
fixed pages stay within the unary ceiling (pinned by a compile-time
assert in join_chunks.rs; scan_page_at’s ResourceExhausted
escalation degrades a violating page to a bounded stream).
FILTER EXISTS SemiJoin OpenNode pages are this size. The default is
below waratah_stats::PUSHDOWN_TERMS_LIMIT (24_576), so the first
streaming Filter page always broadcasts; later pages on the same
EXISTS cursor promote to hash (use_broadcast_semi in exists.rs,
which measures the page’s actual distinct-key count against the
limit).