Skip to main content

SCAN_DISPATCH_ROW_THRESHOLD

Constant SCAN_DISPATCH_ROW_THRESHOLD 

Source
pub const SCAN_DISPATCH_ROW_THRESHOLD: u64 = 1024;
Expand description

Row-estimate ceiling for caller-thread scan execution (WARATAH_SCAN_DISPATCH_ROW_THRESHOLD overrides; 0 disables).

A scan whose stats upper bound (PartitionService::scan_runs_on_caller) puts the pattern at or below this many rows runs directly on the calling thread instead of being handed to a tokio blocking-pool worker — the unary scan_pattern round trip, the streaming drain (which then returns its frames as an already-collected stream), CountPattern (a count drains the same prefix a scan does), and the predicate-keyed domain scans (see PartitionService::domain_scan_runs_on_caller). A µs-scale seek executed synchronously beats paying the pool wake, whose CFS wakeup-granularity delay was measured as a ~600 µs runnable-but-unscheduled stall of the scan thread behind the small-query latency bimodality. 1024 rows is ~200 µs of warm row-matching in the common case — a quarter of the stall it removes; the estimate bounds returned rows, so delete-heavy uncompacted prefixes can walk more keys than the estimate admits. Estimates are advisory for the thread choice only; both branches return identical rows and frame ordering.