perf(scan): reuse index planning resources across queries - #267
Open
wangyong9999 wants to merge 8 commits into
Open
perf(scan): reuse index planning resources across queries#267wangyong9999 wants to merge 8 commits into
wangyong9999 wants to merge 8 commits into
Conversation
added 5 commits
August 31, 2026 06:24
Contributor
Author
|
The failure came from process-wide BTree pages warmed by an earlier fixture. The cache key now includes the backend namespace, so cross-fixture pages cannot be reused. I restored the exact file-open assertion; all 12 primary-key sorted-index integration cases pass for Parquet and ORC. The latest fork workflows are waiting for maintainer approval. |
wangyong9999
commented
Aug 31, 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.
Purpose
Linked issue: N/A
Repeated DataEvolution/global-index scans in one process rebuilt immutable planning state and
discarded BTree pages after each reader was destroyed. This made repeated point lookups spend most
of their time in planning and index I/O.
DataEvolutionBatchScannow reuses theTableSchema,CoreOptions, filesystem, executor,memory pool, and caller-provided cache already initialized by
TableScan. The index scan is stillcreated for the exact requested snapshot.
BTree indexers with the same cache configuration share immutable pages across reader instances.
The process retains at most four cache configurations, and active readers keep an evicted manager
alive only for their own lifetime. Page keys include a backend namespace; filesystem-backed readers
share by filesystem instance, while unknown reader implementations remain isolated. Input streams
are opened only on a cache miss.
Bucket-scoped manifest cache entries now require both the snapshot ID and its base/delta
manifest-list generation to match. Whole-table and row-range scans do not use this cache. Cache
load/deserialize/store failures continue to rebuild from manifests.
The shared-cache registry mutex covers only manager lookup/creation. Page access continues through
the existing thread-safe bounded LRU. The eager
BlockCacheconstructor andClose()behavior areunchanged.
On an HDFS primary-key table with 606K rows, 51 active files, and 6.5 GB of data, a
logidlookupreturning two rows changed from 851/163/1015 ms plan/read/total on the cold run to 115/99/214 ms on
the second run in the same process. BTree evaluation changed from 621 ms to 0.55 ms. Both runs
selected one indexed split, one data file, and a two-row range, and matched an index-disabled scan.
Tests
paimon-common-test: 1,497 passed.paimon-common-sst-file-format-test: 33 passed.paimon-core-test: 1,862 passed.paimon-primary-key-sorted-index-inte-test: 12 passed, including the previously failingParquet and ORC multi-source ordinal cases.
paimon-global-index-test: 132 passed.cache-key namespace separation, and snapshot generation validation.
validation status=PASS,path_proof status=PASS path=pk-file-local-btree.git diff --checkpass on the changedfiles.
GitHub Actions for the latest fork commit are waiting for maintainer approval.
API and Format
Adds an overload of
CacheKey::ForPositionthat accepts an internal backend namespace. This is anadditive API change. There is no object-layout, table storage-format, or protocol change. The
process-local snapshot cache serialization version changes; older cached bytes fail validation and
are rebuilt.
Documentation
No new user-facing option or feature.
Generative AI tooling
Generated-by: Codex (GPT-5)