Repository navigation
perf: execute fused INCLUDE Top-K over vector chunks - #28488
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Keep filter, vector, and projection columns in one storage request while consuming only vector chunks containing residual-filter survivors. Reuse decoded whole-column hits or a fully cached chunk set before reading compressed input, and preserve the existing legacy and unsorted-selection fallbacks. Introduce a scoped block reader and single-entry conversion from supplied bytes. Reuse FileService cache admission and bounded decode sharing without additional storage reads, keep compressed sources out of decoded-column cache keys, and release raw buffers and temporary chunk ownership deterministically. Share chunk validation and ranking with the single-column reader, preserving physical row coordinates, tie order, distance thresholds, and reader-wide heap state. Cover cache warming, partial hits, ordinary-reader interoperability, FileService decorators, cancellation, Close, and fused-reader error cleanup; add a matched fused-loader benchmark.
6febcb8 to
be6dfc3
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of exact head be6dfc3 against base 91d7297. No confirmed blocking findings.
Reviewed all 11 changed files and the existing fused loader, single-column chunk reader, Top-K accumulator, FileService cache and shared-decode ownership paths. The approved design is recorded by 43fd4ee; retaining one combined storage request while deferring vector decompression is consistent with that design.
Correctness: chunk traversal feeds the same reader-wide accumulator in original selection order, preserving physical row coordinates, duplicate selections, NULL filtering, thresholds and equal-distance precedence. Unsorted selections reconstruct from the held bytes rather than changing traversal semantics; legacy/ineligible and decoded whole-column hits retain the existing path. Directory/payload validation and sibling-entry remapping were checked, including synthetic missing columns and projection of winning rows.
Lifecycle/performance: compressed scope data cannot be admitted under the decoded whole-column key; partial chunk-cache probes release their pins before combined-read fallback. Temporary chunk views and decode tickets remain scoped, error/cancel paths release owned results, and conversion/cache updates hold the active-read guard across concurrent Close. No new background workers or unbounded registry were introduced. The accepted memory tradeoff is compressed block data plus the directory and one newly decoded chunk, with existing cache-hit pins and the explicit unsorted fallback accounted for.
Evidence: checked the new focused cache/sharing, cancellation/Close, corruption, selection and real-writer fused-loader tests; reused the recorded owning-package/race/repetition, INCLUDE BVT and five-sample matched benchmark evidence. Exact-head CI run 34311953674 has successful Ubuntu UT, UT coverage, SCA, shared build and both active multi-CN BVT jobs. Disabled/skipped jobs are not counted as passing evidence. I did not independently rerun native tests or benchmarks in this review. The measured fused-loader improvement is not treated as an end-to-end SQL latency claim.
Merge Queue Status
This pull request spent 1 minute 17 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Tick the box to put this pull request back in the merge queue (same as
|
…28515) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #27854. Replaces the remaining exact-PRE integration and local-DOP scope of #28002 on main after #28488; #28002 is left unchanged and open. ## What this PR does / why we need it: Require standalone scalar PRE domains on both runtime-filter producer and consumer using `MustApply`. Validate the terminal payload before opening entry readers, fail closed on unavailable or malformed required input, and keep required scans on the coordinator independently of placement hints. Use a shared exact integer membership filter for storage Top-K, and the existing fused filter-before-Top-K path for residual or noninteger required predicates. Carry the small-domain all-centroids decision explicitly and constrain that scan with a version prefix. Preserve existing nprobe, candidate budgets, visibility, distance semantics, final rechecks, and exact fallback paths. Add default-off `vectorLocalDOP=1` scheduling for synchronous, uncorrelated, single-round integer PRE searches. Estimate physical work from hidden entries statistics, preserve it through plan copying, serialization and EXPLAIN, and cap parallelism by scan work, objects, CPU and `max_dop`. Recheck the current gate when compiling execution so cached plans cannot retain disabled parallelism. Prepare one generation-owned domain, metadata version, centroid route and snapshot before publishing disjoint local readers. Give each reader independent scan state and cancellation, retain logical CN/cache identity, aggregate round diagnostics, and release shared resources after the last reader closes. Keep `Hooks.NewReader` and correlated APPLY interfaces unchanged. ## Design and rollout The [approved design](https://github.com/aunjgr/matrixone/blob/23d4a971b4/docs/design/exact_pre_storage_local_dop.md) was recorded before implementation. This reuses main's `must_apply=12`, appends advisory `scan_work=18`, and integrates the storage paths already present after #28488. Exact membership is not globally exact ANN search. Local DOP stays off unless `optimizer_hints='vectorLocalDOP=1'` is selected. Controlled Wiki-10M A/B/C evidence remains a prerequisite for proposing default-on; this PR makes no workload-speedup claim. ## Validation - Normal owning-package tests: planner, EXPLAIN, compiler, IVF-FLAT plugins/readers and SQL scan adapter. - Owning-package race tests for IVF-FLAT, SQL scan adapter and compiler; 100 focused repetitions of concurrent shared-generation readers, including one shared historical snapshot clone. - Two-CN SQL regression using 125 rows, two explicitly flushed entries objects and injected cost statistics: identical results at DOP 1/2, required empty-domain handling and coordinator-local placement. - Extended 30-statement BVT and existing 68-statement end-to-end BVT each passed twice on the same instance; database teardown verified between runs. - Required-domain malformed/type/null/cardinality/PASS/cancellation rejection, memory-admission denial and partial-construction cleanup; exact integer, string, residual, full-centroid and descending-fallback storage paths. - `make config static-check`: package graph, repository lint, license checks and golangci-lint. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#24097; this does not close the umbrella performance issue. Follows matrixorigin#28434 and matrixorigin#28442. ## What this PR does / why we need it: Compute fused INCLUDE vector Top-K directly over persisted chunks instead of reconstructing and serializing a whole vector column. Keep filter, vector, and projection columns in one storage request on cache misses, then decode only vector chunks containing residual-filter survivors. Reuse decoded whole-column cache hits or a fully cached set of chunks before reading compressed input. Introduce scoped block-read ownership and single-entry conversion from supplied bytes so chunks use existing cache admission and bounded decode sharing without additional storage reads. Keep compressed sources out of decoded-column cache keys and release raw buffers and temporary chunk ownership deterministically. Share chunk validation and ranking with the single-column reader, preserving physical row coordinates, selection order, ties, thresholds, and reader-wide heap state. Retain legacy and unsupported-operation behavior, and reconstruct unsorted selections only from already-held sources. Projection decoding, storage encoding, parallelism, and buffer recycling are unchanged. ## Design and validation The design was approved before implementation and recorded in commit 43fd4ee. The design document is included in this implementation PR; no separate documentation PR is required. - Owning packages and block-reader consumer pass: `pkg/fileservice`, `pkg/objectio`, `pkg/objectio/ioutil`, and `pkg/vm/engine/tae/blockio`. - Owning FileService/ObjectIO packages pass under the race detector. Individually selected lifecycle, sharing, chunk-reader, and fused-consumer tests pass 100 race repetitions. - Tests cover sparse/dense/empty/unsorted selections, cache warming and partial hits, ordinary-reader interoperability, immutable encoded data, FileService decorators, malformed input, cancellation, Close, and selector/materialization cleanup. - The real fused consumer exercises both legacy data and chunked output from the production writer. Miniature persisted fixtures cover chunk boundaries without large datasets. - Existing IVF INCLUDE `pre_post_modes`, `mode_paths`, and `end_to_end` SQL cases pass twice in normal comparison mode, with teardown verified after each run. - Full repository SCA passes. ### Performance evidence Five alternating main/candidate samples of `BenchmarkFusedTopN` against main `f0c31cd4b8`, using the unchanged public fused loader, production-written 4096×768 vectors, Go 1.26.4 production SIMD mode, eight CPUs, and identical cache pressure and requests. Medians: | Workload | Main elapsed | PR elapsed | Main CPU | PR CPU | |---|---:|---:|---:|---:| | Dense, chunked miss | 5.702 ms | 0.700 ms | 11.189 ms | 0.738 ms | | Sparse, chunked miss | 5.334 ms | 0.249 ms | 10.738 ms | 0.280 ms | | Eight overlapping readers | 6.773 ms | 1.923 ms | 16.451 ms | 5.539 ms | | Legacy column | 0.690 ms | 0.684 ms | 0.730 ms | 0.718 ms | | Existing whole-column cache hit | 0.241 ms | 0.245 ms | 0.247 ms | 0.250 ms | | Cache warmed by each implementation | 0.241 ms | 0.249 ms | 0.243 ms | 0.253 ms | Cold storage reads and requested bytes are unchanged: one read/122,221 bytes for dense or sparse, eight reads/977,768 bytes for the overlapping cohort. Both warm paths perform zero storage reads. The largest decoded allocation falls from 16 MiB to 8 MiB. Dense Go allocation falls from approximately 65.2 MiB to 332 KiB per operation; total decoded backing allocation remains 16 MiB for dense reads and falls to 8 MiB for sparse reads. Warm-cache bookkeeping adds up to 3.4% elapsed time / 4.0% CPU in these samples, below the 5% control gate. These are fused-loader benchmarks, not SQL or Wiki-10M latency claims. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…atrixorigin#28515) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#27854. Replaces the remaining exact-PRE integration and local-DOP scope of matrixorigin#28002 on main after matrixorigin#28488; matrixorigin#28002 is left unchanged and open. ## What this PR does / why we need it: Require standalone scalar PRE domains on both runtime-filter producer and consumer using `MustApply`. Validate the terminal payload before opening entry readers, fail closed on unavailable or malformed required input, and keep required scans on the coordinator independently of placement hints. Use a shared exact integer membership filter for storage Top-K, and the existing fused filter-before-Top-K path for residual or noninteger required predicates. Carry the small-domain all-centroids decision explicitly and constrain that scan with a version prefix. Preserve existing nprobe, candidate budgets, visibility, distance semantics, final rechecks, and exact fallback paths. Add default-off `vectorLocalDOP=1` scheduling for synchronous, uncorrelated, single-round integer PRE searches. Estimate physical work from hidden entries statistics, preserve it through plan copying, serialization and EXPLAIN, and cap parallelism by scan work, objects, CPU and `max_dop`. Recheck the current gate when compiling execution so cached plans cannot retain disabled parallelism. Prepare one generation-owned domain, metadata version, centroid route and snapshot before publishing disjoint local readers. Give each reader independent scan state and cancellation, retain logical CN/cache identity, aggregate round diagnostics, and release shared resources after the last reader closes. Keep `Hooks.NewReader` and correlated APPLY interfaces unchanged. ## Design and rollout The [approved design](https://github.com/aunjgr/matrixone/blob/23d4a971b4/docs/design/exact_pre_storage_local_dop.md) was recorded before implementation. This reuses main's `must_apply=12`, appends advisory `scan_work=18`, and integrates the storage paths already present after matrixorigin#28488. Exact membership is not globally exact ANN search. Local DOP stays off unless `optimizer_hints='vectorLocalDOP=1'` is selected. Controlled Wiki-10M A/B/C evidence remains a prerequisite for proposing default-on; this PR makes no workload-speedup claim. ## Validation - Normal owning-package tests: planner, EXPLAIN, compiler, IVF-FLAT plugins/readers and SQL scan adapter. - Owning-package race tests for IVF-FLAT, SQL scan adapter and compiler; 100 focused repetitions of concurrent shared-generation readers, including one shared historical snapshot clone. - Two-CN SQL regression using 125 rows, two explicitly flushed entries objects and injected cost statistics: identical results at DOP 1/2, required empty-domain handling and coordinator-local placement. - Extended 30-statement BVT and existing 68-statement end-to-end BVT each passed twice on the same instance; database teardown verified between runs. - Required-domain malformed/type/null/cardinality/PASS/cancellation rejection, memory-admission denial and partial-construction cleanup; exact integer, string, residual, full-centroid and descending-fallback storage paths. - `make config static-check`: package graph, repository lint, license checks and golangci-lint. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#24097; this does not close the umbrella performance issue. Follows matrixorigin#28434 and matrixorigin#28442. ## What this PR does / why we need it: Compute fused INCLUDE vector Top-K directly over persisted chunks instead of reconstructing and serializing a whole vector column. Keep filter, vector, and projection columns in one storage request on cache misses, then decode only vector chunks containing residual-filter survivors. Reuse decoded whole-column cache hits or a fully cached set of chunks before reading compressed input. Introduce scoped block-read ownership and single-entry conversion from supplied bytes so chunks use existing cache admission and bounded decode sharing without additional storage reads. Keep compressed sources out of decoded-column cache keys and release raw buffers and temporary chunk ownership deterministically. Share chunk validation and ranking with the single-column reader, preserving physical row coordinates, selection order, ties, thresholds, and reader-wide heap state. Retain legacy and unsupported-operation behavior, and reconstruct unsorted selections only from already-held sources. Projection decoding, storage encoding, parallelism, and buffer recycling are unchanged. ## Design and validation The design was approved before implementation and recorded in commit 43fd4ee. The design document is included in this implementation PR; no separate documentation PR is required. - Owning packages and block-reader consumer pass: `pkg/fileservice`, `pkg/objectio`, `pkg/objectio/ioutil`, and `pkg/vm/engine/tae/blockio`. - Owning FileService/ObjectIO packages pass under the race detector. Individually selected lifecycle, sharing, chunk-reader, and fused-consumer tests pass 100 race repetitions. - Tests cover sparse/dense/empty/unsorted selections, cache warming and partial hits, ordinary-reader interoperability, immutable encoded data, FileService decorators, malformed input, cancellation, Close, and selector/materialization cleanup. - The real fused consumer exercises both legacy data and chunked output from the production writer. Miniature persisted fixtures cover chunk boundaries without large datasets. - Existing IVF INCLUDE `pre_post_modes`, `mode_paths`, and `end_to_end` SQL cases pass twice in normal comparison mode, with teardown verified after each run. - Full repository SCA passes. ### Performance evidence Five alternating main/candidate samples of `BenchmarkFusedTopN` against main `f0c31cd4b8`, using the unchanged public fused loader, production-written 4096×768 vectors, Go 1.26.4 production SIMD mode, eight CPUs, and identical cache pressure and requests. Medians: | Workload | Main elapsed | PR elapsed | Main CPU | PR CPU | |---|---:|---:|---:|---:| | Dense, chunked miss | 5.702 ms | 0.700 ms | 11.189 ms | 0.738 ms | | Sparse, chunked miss | 5.334 ms | 0.249 ms | 10.738 ms | 0.280 ms | | Eight overlapping readers | 6.773 ms | 1.923 ms | 16.451 ms | 5.539 ms | | Legacy column | 0.690 ms | 0.684 ms | 0.730 ms | 0.718 ms | | Existing whole-column cache hit | 0.241 ms | 0.245 ms | 0.247 ms | 0.250 ms | | Cache warmed by each implementation | 0.241 ms | 0.249 ms | 0.243 ms | 0.253 ms | Cold storage reads and requested bytes are unchanged: one read/122,221 bytes for dense or sparse, eight reads/977,768 bytes for the overlapping cohort. Both warm paths perform zero storage reads. The largest decoded allocation falls from 16 MiB to 8 MiB. Dense Go allocation falls from approximately 65.2 MiB to 332 KiB per operation; total decoded backing allocation remains 16 MiB for dense reads and falls to 8 MiB for sparse reads. Warm-cache bookkeeping adds up to 3.4% elapsed time / 4.0% CPU in these samples, below the 5% control gate. These are fused-loader benchmarks, not SQL or Wiki-10M latency claims. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…atrixorigin#28515) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#27854. Replaces the remaining exact-PRE integration and local-DOP scope of matrixorigin#28002 on main after matrixorigin#28488; matrixorigin#28002 is left unchanged and open. ## What this PR does / why we need it: Require standalone scalar PRE domains on both runtime-filter producer and consumer using `MustApply`. Validate the terminal payload before opening entry readers, fail closed on unavailable or malformed required input, and keep required scans on the coordinator independently of placement hints. Use a shared exact integer membership filter for storage Top-K, and the existing fused filter-before-Top-K path for residual or noninteger required predicates. Carry the small-domain all-centroids decision explicitly and constrain that scan with a version prefix. Preserve existing nprobe, candidate budgets, visibility, distance semantics, final rechecks, and exact fallback paths. Add default-off `vectorLocalDOP=1` scheduling for synchronous, uncorrelated, single-round integer PRE searches. Estimate physical work from hidden entries statistics, preserve it through plan copying, serialization and EXPLAIN, and cap parallelism by scan work, objects, CPU and `max_dop`. Recheck the current gate when compiling execution so cached plans cannot retain disabled parallelism. Prepare one generation-owned domain, metadata version, centroid route and snapshot before publishing disjoint local readers. Give each reader independent scan state and cancellation, retain logical CN/cache identity, aggregate round diagnostics, and release shared resources after the last reader closes. Keep `Hooks.NewReader` and correlated APPLY interfaces unchanged. ## Design and rollout The [approved design](https://github.com/aunjgr/matrixone/blob/23d4a971b4/docs/design/exact_pre_storage_local_dop.md) was recorded before implementation. This reuses main's `must_apply=12`, appends advisory `scan_work=18`, and integrates the storage paths already present after matrixorigin#28488. Exact membership is not globally exact ANN search. Local DOP stays off unless `optimizer_hints='vectorLocalDOP=1'` is selected. Controlled Wiki-10M A/B/C evidence remains a prerequisite for proposing default-on; this PR makes no workload-speedup claim. ## Validation - Normal owning-package tests: planner, EXPLAIN, compiler, IVF-FLAT plugins/readers and SQL scan adapter. - Owning-package race tests for IVF-FLAT, SQL scan adapter and compiler; 100 focused repetitions of concurrent shared-generation readers, including one shared historical snapshot clone. - Two-CN SQL regression using 125 rows, two explicitly flushed entries objects and injected cost statistics: identical results at DOP 1/2, required empty-domain handling and coordinator-local placement. - Extended 30-statement BVT and existing 68-statement end-to-end BVT each passed twice on the same instance; database teardown verified between runs. - Required-domain malformed/type/null/cardinality/PASS/cancellation rejection, memory-admission denial and partial-construction cleanup; exact integer, string, residual, full-centroid and descending-fallback storage paths. - `make config static-check`: package graph, repository lint, license checks and golangci-lint. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#24097; this does not close the umbrella performance issue. Follows matrixorigin#28434 and matrixorigin#28442. ## What this PR does / why we need it: Compute fused INCLUDE vector Top-K directly over persisted chunks instead of reconstructing and serializing a whole vector column. Keep filter, vector, and projection columns in one storage request on cache misses, then decode only vector chunks containing residual-filter survivors. Reuse decoded whole-column cache hits or a fully cached set of chunks before reading compressed input. Introduce scoped block-read ownership and single-entry conversion from supplied bytes so chunks use existing cache admission and bounded decode sharing without additional storage reads. Keep compressed sources out of decoded-column cache keys and release raw buffers and temporary chunk ownership deterministically. Share chunk validation and ranking with the single-column reader, preserving physical row coordinates, selection order, ties, thresholds, and reader-wide heap state. Retain legacy and unsupported-operation behavior, and reconstruct unsorted selections only from already-held sources. Projection decoding, storage encoding, parallelism, and buffer recycling are unchanged. ## Design and validation The design was approved before implementation and recorded in commit 43fd4ee. The design document is included in this implementation PR; no separate documentation PR is required. - Owning packages and block-reader consumer pass: `pkg/fileservice`, `pkg/objectio`, `pkg/objectio/ioutil`, and `pkg/vm/engine/tae/blockio`. - Owning FileService/ObjectIO packages pass under the race detector. Individually selected lifecycle, sharing, chunk-reader, and fused-consumer tests pass 100 race repetitions. - Tests cover sparse/dense/empty/unsorted selections, cache warming and partial hits, ordinary-reader interoperability, immutable encoded data, FileService decorators, malformed input, cancellation, Close, and selector/materialization cleanup. - The real fused consumer exercises both legacy data and chunked output from the production writer. Miniature persisted fixtures cover chunk boundaries without large datasets. - Existing IVF INCLUDE `pre_post_modes`, `mode_paths`, and `end_to_end` SQL cases pass twice in normal comparison mode, with teardown verified after each run. - Full repository SCA passes. ### Performance evidence Five alternating main/candidate samples of `BenchmarkFusedTopN` against main `f0c31cd4b8`, using the unchanged public fused loader, production-written 4096×768 vectors, Go 1.26.4 production SIMD mode, eight CPUs, and identical cache pressure and requests. Medians: | Workload | Main elapsed | PR elapsed | Main CPU | PR CPU | |---|---:|---:|---:|---:| | Dense, chunked miss | 5.702 ms | 0.700 ms | 11.189 ms | 0.738 ms | | Sparse, chunked miss | 5.334 ms | 0.249 ms | 10.738 ms | 0.280 ms | | Eight overlapping readers | 6.773 ms | 1.923 ms | 16.451 ms | 5.539 ms | | Legacy column | 0.690 ms | 0.684 ms | 0.730 ms | 0.718 ms | | Existing whole-column cache hit | 0.241 ms | 0.245 ms | 0.247 ms | 0.250 ms | | Cache warmed by each implementation | 0.241 ms | 0.249 ms | 0.243 ms | 0.253 ms | Cold storage reads and requested bytes are unchanged: one read/122,221 bytes for dense or sparse, eight reads/977,768 bytes for the overlapping cohort. Both warm paths perform zero storage reads. The largest decoded allocation falls from 16 MiB to 8 MiB. Dense Go allocation falls from approximately 65.2 MiB to 332 KiB per operation; total decoded backing allocation remains 16 MiB for dense reads and falls to 8 MiB for sparse reads. Warm-cache bookkeeping adds up to 3.4% elapsed time / 4.0% CPU in these samples, below the 5% control gate. These are fused-loader benchmarks, not SQL or Wiki-10M latency claims. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…atrixorigin#28515) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#27854. Replaces the remaining exact-PRE integration and local-DOP scope of matrixorigin#28002 on main after matrixorigin#28488; matrixorigin#28002 is left unchanged and open. ## What this PR does / why we need it: Require standalone scalar PRE domains on both runtime-filter producer and consumer using `MustApply`. Validate the terminal payload before opening entry readers, fail closed on unavailable or malformed required input, and keep required scans on the coordinator independently of placement hints. Use a shared exact integer membership filter for storage Top-K, and the existing fused filter-before-Top-K path for residual or noninteger required predicates. Carry the small-domain all-centroids decision explicitly and constrain that scan with a version prefix. Preserve existing nprobe, candidate budgets, visibility, distance semantics, final rechecks, and exact fallback paths. Add default-off `vectorLocalDOP=1` scheduling for synchronous, uncorrelated, single-round integer PRE searches. Estimate physical work from hidden entries statistics, preserve it through plan copying, serialization and EXPLAIN, and cap parallelism by scan work, objects, CPU and `max_dop`. Recheck the current gate when compiling execution so cached plans cannot retain disabled parallelism. Prepare one generation-owned domain, metadata version, centroid route and snapshot before publishing disjoint local readers. Give each reader independent scan state and cancellation, retain logical CN/cache identity, aggregate round diagnostics, and release shared resources after the last reader closes. Keep `Hooks.NewReader` and correlated APPLY interfaces unchanged. ## Design and rollout The [approved design](https://github.com/aunjgr/matrixone/blob/23d4a971b4/docs/design/exact_pre_storage_local_dop.md) was recorded before implementation. This reuses main's `must_apply=12`, appends advisory `scan_work=18`, and integrates the storage paths already present after matrixorigin#28488. Exact membership is not globally exact ANN search. Local DOP stays off unless `optimizer_hints='vectorLocalDOP=1'` is selected. Controlled Wiki-10M A/B/C evidence remains a prerequisite for proposing default-on; this PR makes no workload-speedup claim. ## Validation - Normal owning-package tests: planner, EXPLAIN, compiler, IVF-FLAT plugins/readers and SQL scan adapter. - Owning-package race tests for IVF-FLAT, SQL scan adapter and compiler; 100 focused repetitions of concurrent shared-generation readers, including one shared historical snapshot clone. - Two-CN SQL regression using 125 rows, two explicitly flushed entries objects and injected cost statistics: identical results at DOP 1/2, required empty-domain handling and coordinator-local placement. - Extended 30-statement BVT and existing 68-statement end-to-end BVT each passed twice on the same instance; database teardown verified between runs. - Required-domain malformed/type/null/cardinality/PASS/cancellation rejection, memory-admission denial and partial-construction cleanup; exact integer, string, residual, full-centroid and descending-fallback storage paths. - `make config static-check`: package graph, repository lint, license checks and golangci-lint. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Related to #24097; this does not close the umbrella performance issue. Follows #28434 and #28442.
What this PR does / why we need it:
Compute fused INCLUDE vector Top-K directly over persisted chunks instead of reconstructing and serializing a whole vector column. Keep filter, vector, and projection columns in one storage request on cache misses, then decode only vector chunks containing residual-filter survivors.
Reuse decoded whole-column cache hits or a fully cached set of chunks before reading compressed input. Introduce scoped block-read ownership and single-entry conversion from supplied bytes so chunks use existing cache admission and bounded decode sharing without additional storage reads. Keep compressed sources out of decoded-column cache keys and release raw buffers and temporary chunk ownership deterministically.
Share chunk validation and ranking with the single-column reader, preserving physical row coordinates, selection order, ties, thresholds, and reader-wide heap state. Retain legacy and unsupported-operation behavior, and reconstruct unsorted selections only from already-held sources. Projection decoding, storage encoding, parallelism, and buffer recycling are unchanged.
Design and validation
The design was approved before implementation and recorded in commit 43fd4ee. The design document is included in this implementation PR; no separate documentation PR is required.
pkg/fileservice,pkg/objectio,pkg/objectio/ioutil, andpkg/vm/engine/tae/blockio.pre_post_modes,mode_paths, andend_to_endSQL cases pass twice in normal comparison mode, with teardown verified after each run.Performance evidence
Five alternating main/candidate samples of
BenchmarkFusedTopNagainst mainf0c31cd4b8, using the unchanged public fused loader, production-written 4096×768 vectors, Go 1.26.4 production SIMD mode, eight CPUs, and identical cache pressure and requests. Medians:Cold storage reads and requested bytes are unchanged: one read/122,221 bytes for dense or sparse, eight reads/977,768 bytes for the overlapping cohort. Both warm paths perform zero storage reads. The largest decoded allocation falls from 16 MiB to 8 MiB. Dense Go allocation falls from approximately 65.2 MiB to 332 KiB per operation; total decoded backing allocation remains 16 MiB for dense reads and falls to 8 MiB for sparse reads.
Warm-cache bookkeeping adds up to 3.4% elapsed time / 4.0% CPU in these samples, below the 5% control gate. These are fused-loader benchmarks, not SQL or Wiki-10M latency claims.