Skip to main content

FETCH_ONCE_SEEK_EQUIV_MILLI

Constant FETCH_ONCE_SEEK_EQUIV_MILLI 

Source
pub const FETCH_ONCE_SEEK_EQUIV_MILLI: u64 = 4_200;
Expand description

Seek-vs-scan exchange rate for the fetch-once trigger predicate, in milli-rows: one index seek costs this many sequentially-streamed rows.

Used by: the priced comparison in [crate::plan] that decides whether a probe arm broadcasts per-page key lists (per-page mode) or drains once into a built table (fetch-once mode): pages × (broadcast seeks × this + matched rows × MATCHED_ROW_EQUIV) ≥ MARGIN × whole_read_rows (one seek list per page — the first surviving key’s, the runtime’s join_keys_scan_filter pick; whole_read_rows is the unclamped whole-arm estimate). Both consumers — the seating comparator’s build price and the ScanOp::fetch_once plan stamp — read the same constant through the same predicate, so plan and runtime cannot diverge.

Measured: 3.6–4.9 rows per seek across the bellendena corpus arms (scripts/calibrate_seek_ratio.py realworld mode, release builds): the stable arms sit at ~3.6 under every reconstructable condition, and the warm-cache big arms reach ~4.9. One arm class (a multi-million-row whole read) is regime-volatile by at least ±40% cold-to-warm — a pin must never rest on that arm alone; anchor on the stable arms or take cold+warm bands. The default is the measured band’s midpoint region (the calibration script’s own historical range was 3.6–5.0), chosen to sit off the corpus verdicts’ flip points rather than on one, so run-to-run regime swing cannot silently flip a verdict. Re-measure when the transport or index shape changes.

Placement rule: this exchange rate belongs ONLY to fetch-once-class decisions (whole-fetch vs selective-push). The seating comparator’s own {rows, seeks} lexicographic order must never fold it in — the ordering is deliberately rate-free.