Expand description
Correlated-subquery evaluation split out of lib.rs (lib.rs split
5): the per-row eval_expr_with_correlated path (clones the
expression, substitutes outer-row columns into each surviving
subquery node, runs the inner SELECT, folds the literal result back)
plus the subquery_replacement pre-walk that materialises
uncorrelated subquery nodes once, and the try_batch_correlated_scalar
keyed-probe optimisation (round-22 phase 3) that runs a correlated
scalar subquery ONCE without the correlation and folds rows into a
key→value map. impl Engine methods; the bare-SELECT / DML / join
row loops drive eval_expr_with_correlated, and select.rs drives
subquery_replacement / try_batch_correlated_scalar.
Structs§
- Scalar
PkProbe Fast Path - v7.32 (R30 memory) — cheap static correlation pre-check.
Statics§
- BATCHED_
SCALAR_ FALL_ THROUGH_ COUNT - BATCHED_
SCALAR_ KEYED_ FIRE_ COUNT - v7.37.4 A’ — per-keyed-probe / per-fallback counters for the batched scalar subquery resolver. Used by perf-gate instrumentation to distinguish “keyed path fires but per-probe is slow” from “keyed path never fires” — A’ targets the former.
- BATCHED_
SCALAR_ KEYED_ PROBE_ COUNT - EXISTS_
BATCH_ FALL_ THROUGH_ COUNT - EXISTS_
BATCH_ FIRE_ COUNT - EXISTS_
PULLUP_ FIRE_ COUNT - v7.37.4 A’ — EXISTS path counters. Distinguish whether mailrs
prod’s 2-column NOT EXISTS goes through the cheap
try_batch_correlated_exists(one inner scan + per-row hash probe) or the slowpull_up_exists_sublinksrewrite (rejects multi-column correlation today). Ablation finding 2026-06-19: the NOT EXISTS conjunct in/api/conversationscosts ~165 ms per 100k bench iteration — figure out which path is actually being taken. - EXISTS_
PULLUP_ MULTICOL_ DISABLE - v7.37.4 A’’ — differential knob. When true, the multi-column
branch of
try_pull_up_exists_sublinkrejects (falling back to the v7.34.2 batch resolver path); single-column EXISTS pullup still fires. Lets the differential e2e prove byte-equal results between the new pullup path and the legacy batch path. Default false — production never sets this. - PULLUP_
LIMI T1_ FIRE_ COUNT - v7.37.4 — fire counter for the LIMIT 1 pullup pass. Tests inspect this to confirm whether the rewrite actually triggered on a given SQL shape (semantic-equivalence tests pass either way). Relaxed ordering is fine: tests synchronize on full query execution.
- SCALARSQ_
PK_ PROBE_ FIRED - SCALARSQ_
PK_ PROBE_ PLAN_ FIRED - v7.37.x — per-row hit counter for the plan-cached fast path.
- SCALARSQ_
PK_ PROBE_ PLAN_ OUTER_ INT
Functions§
- expr_
tree_ has_ subquery - Quick scan for any subquery-bearing node in a SELECT’s WHERE /
projection /
order_by— saves cloning the AST when there are none (the common case).