perf: prune V2 LIMIT/OFFSET scans by live row counts - #9344
LeoReeYang wants to merge 4 commits into
Conversation
|
Please unify the V2 LIMIT/OFFSET planning path across stable and non-stable row IDs, with and without deletions. Fragment pruning only needs scan order and live-row counts; it does not depend on row-ID encoding. The current Please move live-row counting out of the row-ID branch as well, reusing the loaded physical count and deletion vector for ordinary scans. Keep the branches for ID mapping, preserve existing fallback behavior when metadata is unavailable, and leave V1 unchanged. Parameterize the correctness and fragment-pruning tests across both row-ID modes and deletion states. |
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The generalized V2 planner now uses one validated live-row prefix for stable and address row IDs, with or without deletion vectors, while keeping row-ID mapping separate and retaining the prior V1 or incomplete-metadata fallbacks. Parameterized correctness and structural-pruning coverage exercises all four V2 combinations, making this shared mechanism preferable to the narrower stable-only branch without introducing a new format contract.
|
Addressed in |
|
LGTM, @wjones127 could you take a look? |
Summary
physical_rows - num_deleted_rows) while preserving the requested fragment order.FilteredReadExec; keep stable and address-based row-ID mapping as separate branches.include_deleted_rowson their existing fallback paths.The correctness invariant is that the optimized scan over an ordered fragment sequence equals a full scan over the same sequence followed by
slice(offset, limit). Tests cover explicit/reordered fragment subsets as well as all four row-ID/deletion combinations.Benchmark
cargo bench -p lance --bench stable_row_id_limit --profile release-with-debug -- --noplotRelease-profile Criterion benchmark on the same WSL host, using the same benchmark source on the parent commit and the final branch:
88b455fbd(deletions disable pushdown)1029a8f2aThe final implementation is approximately 21.7x faster, reducing center latency by 95.4% for this workload. The pruning regression independently verifies that 32 candidate fragments are reduced to one planned fragment in every row-ID/deletion combination.
Validation
cargo fmt --all -- --checkcargo check -p lance --tests --benchescargo clippy --all --tests --benches -- -D warningscargo test -p lance limit_pushdown -- --nocapture(15 passed)Addresses #8850.