Skip to content

[Feature Request]: Reduce execution materialization with dictionary vectors #32379

Open

Description

@aunjgr

Is there an existing issue for the same feature request?

Is your feature request related to a problem?

The retained TPC-H captures show repeated vector gathers/copies around joins and shuffle. This issue tracks the approved engine representation work within #30838. Historical profiles motivate the work; no current-main speedup is claimed.

Describe the feature you'd like

Introduce engine-wide in-memory dictionary vectors over immutable flat/constant backing and accounted shared selections. Preserve logical values, NULL/grouping state and string/prepared-parameter metadata. Use explicit logical read views, copy-on-write and materialization boundaries so producers can avoid payload copies without exposing unsupported representations to legacy consumers.

Describe implementation you've considered

Approved seven-PR execution series:

  1. Replace perf(scan): apply complete local key domains before shuffle and probing #32098 with early complete-domain scan filtering, independently of dictionary vectors ([Subtask]: Reduce hash-join input with effective runtime filters and build/probe choices #30844).
  2. Dictionary representation, ownership, read views and accounting; no producer enabled.
  3. Explicit compatibility/normalization boundaries; no producer enabled.
  4. Dictionary-aware expression, join, aggregate and copy consumers; no producer enabled.
  5. Enable scan/filter/projection producers; primary target Q12.
  6. Enable shuffle and eligible join producers; primary target Q9.
  7. Integrate reader filtering and selected payload construction; primary target Q19.

Use existing leases where available, promote uniquely owned backing to shared immutable ownership, snapshot mutable metadata and account actual retained bytes until final release. Collapse nested dictionaries to one base mapping. Unknown/legacy ownership and unsupported consumers use explicit accounted materialization. Keep flat fast paths, existing SQL semantics and execution placement.

Documentation, Adoption, Use Case, Migration Strategy

Implementation begins with versioned design documents and a consumer/ownership matrix. The requester approved engine-wide scope and neutral infrastructure PRs on 2026-11-09. Producer-enabling changes require confirmed primary-query speedups; #32098 requires a confirmed Q9 speedup.

Persisted and transmitted vectors remain in the existing flat format. No SQL schema, cache-replacement algorithm or new cache tier is introduced. Q15 producer sharing, Q20 aggregation rewrites, codecs and additional decimal SIMD are outside this wave. No SF1000 qualification is required for this wave.

Additional information

Activity

  1. self-assigned this
    on Nov 8, 2026
  2. added
    severity/s0
    on Nov 8, 2026
  3. aunjgr commented on Nov 8, 2026

    @aunjgr
    ContributorAuthor

    The approved execution series now has a design-only PR #32380, version adebe845cb4a77d97cf7dd0ae4b2efaf87dc224a: early runtime-filter domains and dictionary-vector execution.

    Implementation starts with replacing #32098's shuffle-only hook with complete domains from independent filtered scans. The engine-wide dictionary stages are tracked in #32379. Neutral foundations are allowed; producer enablement requires the predeclared target-query gain. SF10/SF100 qualification applies; Q15/Q20 rewrites and SF1000 are outside this wave. Existing issue descriptions and performance evidence remain unchanged. No new benchmark result is claimed.

  4. aunjgr commented on Nov 8, 2026

    @aunjgr
    ContributorAuthor

    The dictionary stages now have templated s0 subtasks assigned to aunjgr:

    PR1 remains the #32098 replacement under #30844. Design revision and delivery gates are in #32380. No implementation stage or performance gate is marked complete by creating these tasks.

  5. aunjgr commented on Nov 9, 2026

    @aunjgr
    ContributorAuthor

    Dictionary representation/ownership foundation is now draft #32394 (subtask #32383), using the PR template. No dictionary SQL producers are enabled. Source-pinned SF10 all22 RAM/disk results are appended to the PR conversation; SF100 remains pending a quiet server129 window. The requester approved the early-filter admission amendment: keep the strict10% NDV threshold, evaluate completed source cardinality per target, and retain the64MiB cap. That replacement is being implemented in #32098. Dependent normalization/consumer/producer stages still wait for their prerequisite merge.

  6. aunjgr commented on Nov 9, 2026

    @aunjgr
    ContributorAuthor

    Current implementation status:

    • Dictionary foundation feat(vector): add shared dictionary storage and row selections #32394 is published; it enables no SQL dictionary producers. Its current-head SF10 all22 neutral screen passes. SF100 acceptance is still open: the original duplicate tmpfs-image/cache environment hit Q18 memory/spill limits and was rejected. Fresh matching cache-resident pairs preserve128GiBcache and require zero physical reads in memory scores, no spill/swap/OOM. The bounded server129 supervisor waits for stable quiet and retains valid arms; it never retries numeric regressions.
    • Early domains perf(scan): apply complete local key domains before shuffle and probing #32098 now publishes db399919ca, with final-node identity remapping and the conservative unfiltered-probe consumer envelope. The broader and coalescing variants failed the all22 Q10 gate; their tables remain in comments and the buffering was removed. Latest owning tests/full pre-push pass, but fresh all22 latency qualification is still queued for compiler-free local CPUs. SF100 early timing remains disabled.
    • Both stay draft until their recorded gates pass. Capability/normalization [Subtask]: Add explicit dictionary-vector compatibility boundaries #32384 and later consumers/producers retain the prerequisite-merge order. No result tables are placed in issue/PR descriptions, and no benchmark-time data/result verification is added.
  7. aunjgr commented on Nov 9, 2026

    @aunjgr
    ContributorAuthor

    Series implementation update:

    1. Early complete-domain filtering: perf(scan): apply complete local key domains before shuffle and probing #32098, draft; current performance qualification remains open.
    2. Dictionary representation/ownership: feat(vector): add shared dictionary storage and row selections #32394, draft; neutral acceptance remains open.
    3. Compatibility/normalization boundaries ([Subtask]: Add explicit dictionary-vector compatibility boundaries #32384): new stacked draft feat(vm): materialize dictionary batches for unsupported consumers #32405. Owning-package tests, focused lifecycle race and required full static checks pass.
    4. Consumer migration ([Subtask]: Migrate expression and operator consumers to dictionary read views #32385): not implemented yet.
    5. Scan/filter/projection producers ([Subtask]: Enable dictionary scan, filter and projection outputs #32386): not implemented yet.
    6. Shuffle/join producers ([Subtask]: Avoid shuffle and join payload copies with dictionary outputs #32387): not implemented yet.
    7. Reader integration ([Subtask]: Integrate reader filtering with dictionary payload construction #32388): not implemented yet.

    The merge-first restriction on draft development was unnecessary. Dependent source work can be drafted as a stack with explicit prerequisites. Qualification, production enablement and readiness remain isolated after prerequisite merges, under the existing acceptance rules. No producer speedup is claimed for neutral foundation PRs.

  8. aunjgr commented on Nov 9, 2026

    @aunjgr
    ContributorAuthor

    #32098 update: current head db399919ca passed the complete local SF10 gate against main 70952cb466: five independent pairs per RAM/disk profile, all Q1–Q22 plus Total, cold full suites excluded. Q9 wall time improves 10.81% in RAM (95% interval [-15.36%,-6.02%]) and 11.71% on warm disk ([-16.77%,-6.34%]). No Holm-confirmed query or separate-Total regression. Q10's current bypass is verified; neither profile establishes a Q10 regression. Total speedup remains inconclusive.

    Full wall/CPU tables and the source-pinned protocol are appended to #32098. SF100 remains required, and #32098 remains draft. No acceptance criterion was relaxed.

  9. aunjgr commented on Nov 9, 2026

    @aunjgr
    ContributorAuthor

    Current series status: #32098 is ready after its declared SF10/SF100 Q9 and all-query/Total gates and green CI. #32394 is now ready after lease-backed ownership,480-byte header,77.89% local changed-code coverage, normal/race/static checks, both-scale neutral performance gates and fresh CI. SF100 tables: #32394 (comment). The boundary PR #32405 follows this accepted core; its readiness still requires the prerequisite merge and isolated acceptance. The remaining stages stay in scope: #32385 consumers, #32386 scan/filter/projection producers, #32387 shuffle/join producers and #32388 reader integration. No production dictionary producer is enabled.

  10. aunjgr commented on Nov 10, 2026

    @aunjgr
    ContributorAuthor

    Execution-plan audit: #32098 and #32394 are merged. #32405 is published as draft at 540e7aa80a; its revised SF10 neutral gate passes, while CI/SF100 continue independently in background.

    The four later stages are still undelivered: #32385 consumer migration has only a local worktree and no implementation PR; #32386 scan/filter/projection producers, #32387 shuffle/join producers and #32388 reader integration have not been implemented or submitted. I let #32405 acceptance work serialize the entire series, although the approved schedule permits stacked draft development. That was an execution gap, not a requirement to wait for prerequisite merges.

    The work order remains consumer migration → scan/filter/projection producers (Q12) → shuffle/join producers (Q9) → reader integration (Q19), each in its own templated draft PR. The consumer worktree is now advanced to the current boundary parent. Draft development can proceed while #32405's checks run. Prerequisite merges, isolated performance acceptance and production enablement retain their existing gates. No delivered work or performance benefit is claimed for these four pending stages.

  11. aunjgr commented on Nov 10, 2026

    @aunjgr
    ContributorAuthor

    Implementation/protocol update — 2026-11-10

    The requester approved combining #32385 and #32386 into one implementation PR. #32405 has merged; the local implementation was rebased onto main 00da05219f, excluding inherited prerequisite commits. #32387 (shuffle/join output views) and #32388 (deeper early filtering/late payload work) remain separate.

    The requester replaced the repeated-process acceptance protocol for this and future PRs:

    • One process per build, scale and memory/cache configuration; load/open once.
    • Run Q1–Q22 as six complete consecutive suites.
    • Exclude the first cold suite; report/profile/account the following five warm suites.
    • No reload/restart between those suites and no additional five-process-pair layer.
    • Keep all-query and Total reporting, matched budgets, no SF100 spill, and no benchmark-time input/result verification.
    • Warm repetitions describe within-process variation, not independent process samples.

    Q12 remains the predeclared primary speedup target. Q1 is also in the scan-copy/aggregate-read validation scope: its filter is at scan, and dictionary-aware consumers must preserve that copy reduction rather than forcing immediate materialization. This does not replace #30841's small-domain grouping/hash work or #30847's aggregate update-cost work.

    Local consumer, selected reader/tombstone, grouping, join, forwarding and account-lifecycle checks are passing. Performance acceptance and the implementation PR are still pending; no speedup or completion is claimed. Results will be appended in separate comments.

  12. aunjgr commented on Nov 10, 2026

    @aunjgr
    ContributorAuthor

    Implementation is published as templated draft #32492, covering #32385/#32386.

    The revised local SF10 memory qualification failed. Full Q1–Q22/Total results, allocation/profile diagnosis and proposed corrections are recorded separately from the PR description. Product code is frozen pending the requester's review; revised disk/SF100 checks have not run.

    The current protocol is one process per build/configuration, one cold full22 suite excluded and five warm full22 suites profiled/accounted. Qualification is local SF10 memory/disk and local SF100 disk-backed, without spilling/swap/OOM or benchmark-time dataset/result verification. This replaces the older independent-process-pair/server129 wording; it does not weaken the regression gate.

  13. aunjgr commented on Nov 10, 2026

    @aunjgr
    ContributorAuthor

    The ownership and private-header corrections are published in draft #32492, head 73930d6ace, on updated main 1a12e18e68. Functional, race/account, SQL and static checks pass, but the current local SF10 memory qualification still fails the performance gate. Full all22/Total results and read-only diagnosis. Code is frozen pending requester review; disk/SF100 acceptance has not run. Earlier PR benchmark tables have been collapsed to avoid presenting them as current evidence.

  14. assigned and unassigned on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/featureseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions