Repository navigation
Conversation
Add a bench that measures what zone map write seeds cost on the append path and save on the index update path for a matrix of column types and value distributions, emit tracing events when a scalar index merge harvests seeds or falls back to a column scan, and test that a seed-built zone map matches a scan-built one bit for bit. Co-Authored-By: Claude Fable 5.1 <[email protected]>
LuQQiu
marked this pull request as draft
October 8, 2026 21:42
Contributor
Author
|
Trimmed this PR down to what is worth keeping in the tree:
Net diff is now ~300 lines instead of ~2,000. |
This was referenced Oct 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What question does this PR answer?
How much does collecting ZoneMap statistics during an append slow down writing, and how much work does it save when we later update the index?
A ZoneMap summarizes groups of rows with min/max and null information. Write seeds store these summaries in the new data files while those files are being written. A later index update can read the summaries instead of reading the column again.
This PR measures both sides of that tradeoff. It changes no defaults.
What is tested?
The benchmark runs three separate measurements:
micro)ZoneMapSeedWriter, then serialize seeds at each data-file boundary.e2e)benefit)optimize_indices().The cases cover numeric types, Boolean, decimals, strings, binary values, nested types, different null distributions, different zone sizes, and tables with 16 or 64 indexed columns.
Both modes receive identical input for each repetition. Each measurement runs in a fresh child process. The benchmark records read requests and bytes during the index update, and tracing events confirm whether it harvested seeds or fell back to scanning.
How to read the results
(on / off - 1) × 100%. For example,+22%means the append takes 1.22 times as long; it is not a 22% reduction in throughput.optimize_indices()after the append, reading the new column values, computing statistics, and writing the updated index. Covers the whole appended batch.optimize_indices()after the append, reading the saved seeds and writing the updated index. Covers the same appended batch as the without-seeds measurement.Nomeans seeds still provide null information, but cannot provide value-range bounds. All-null zones have no non-null bounds even for a supported type.Row counts: most cases append 4M rows; cases with values of at least 2 KiB append 1M rows. Seed sizes are always normalized to 1M rows. The two timing columns should be compared within each case, not across different row counts.
Results
Medians of five repetitions:
user_<n>Unless specified otherwise, zones contain 8192 rows. Peak RSS during append did not differ measurably between modes. CPU usage increased by 2.7% for the 16-column table and 4.5% for the 64-column table.
What do these results tell us?
These measurements inform follow-up decisions about supported types, default enablement, and seed size. Those decisions are not implemented here.
Validation and scope
47 cases, 1165 child runs, zero reported failures. Seed harvesting was confirmed in all five repetitions of every seeds-on case; seeds-off updates reported
plugin_declinedfallback. Validation passed for every case.The benchmark compares seed-built and scan-built statistics zone by zone, including float validity and bit patterns, and compares query row-ID multisets with indexes enabled and disabled. A regression test specifically covers partial final zones, all-null zones, NaNs, signed zeros, and harvest/fallback events.
This measures the existing path: an indexed column with
use_seeds = true,WriteMode::Append, and a supported data-file version. Collecting seeds without an existing ZoneMap index is separate work. The PR does not measure query speed or the full index's resident memory.Changes included
rust/lance/benches/zone_map_seeds.rs: the three-layer benchmark, process isolation, resource measurements, and validation.index/append.rsand tracing constants:index_seeds_harvestedandindex_seeds_fallback_scanevents, including fallback reasons.dataset/write.rs: the seed-versus-scan regression test.docs/src/guide/performance.md: measured write-seed costs and observations.Environment and reproduction
AMD EPYC 9V65, 368 vCPU, 1.3 TiB RAM, local NVMe RAID 0, Linux 5.15, Rust 1.98.1,
release-with-debug, Lance base518dc4c28plus this branch. Batches contain 8192 rows; data files target 1M rows. OS page cache was warm; Lance caches were cold. “Within noise” means no clear difference was observed, not zero cost.cd rust ROWS=4000000 REPEAT=5 VALIDATE=first OUT=/tmp/zmseed.jsonl DATA_DIR=/mnt/nvme/zmseed \ cargo bench --profile release-with-debug --bench zone_map_seedsSCENARIOS=selects cases (--listprints them);LAYERS=micro,e2e,benefitselects measurements.🤖 Generated with Claude Code