Skip to content

[Subtask]: Reduce hash-join input with effective runtime filters and build/probe choices #30844

Open

Description

@aunjgr

Parent Issue

#30838

Detail of Subtask

Evidence reassessment — 2026-10-26

Current delivery/performance status: DESIGN/VALIDATION OPEN. Compare work volumes before interpreting hash-kernel percentages.

Observed: Pinned SF100 Q9 scans 80M PARTSUPP rows in both engines, but DuckDB sends about 4.79M onwards after filtering while MO sends 80M. Join orientation also differs. Q21 filter effects and Q17 hot mechanisms change with scale; SF10 claims cannot be copied into SF100.

Not yet established: Which filters/orientations remain ineffective on current main, their actual selectivity and delivery cost, and how much hash CPU is extra work versus expensive equivalent probes.

Next discriminating experiment: Measure build rows, filter construction/probe counts, selectivity/false positives, join input and result rows at each affected operator and scale. Separate filter placement, join orientation and intrinsic lookup cost.

Measured target: Unchanged Q9/Q21 and scale-specific Q17 controls with fewer unnecessary probes and lower query CPU/latency.

Mandatory controls and total cost boundary: Unselective filters, tiny inputs, expensive builds, skew/duplicates, NULL-aware membership/anti joins, late filter arrival, cancellation and pressure.

Performance acceptance and rejection

  • Freeze current-main/candidate sources, executables, real caller shapes and effective settings. Use the unchanged qualification SQL and complete result consumption; exclude cold runs and keep profiles separate from latency scoring.
  • Demonstrate the named work/CPU reduction and an attributable uninstrumented target-query improvement. Include the controls below and full Q1-Q22 comparison; component wins, source changes, functional tests, SCA, merging and profile percentages are separate evidence.
  • A confirmed affected/control slowdown fails; unresolved slower signals are inconclusive. Confirm with an independent longer balanced run. No gain elsewhere, favorable average or self-approved tolerance waives a regression.
  • Complete applicable SF10/SF100 and memory/mixed-I/O acceptance before issue closure under the umbrella protocol. Report uncertainty, absolute CPU/instructions/work, allocations/copies and the same whole-application budget, effective cache, I/O/spill/swap/pressure evidence. Benchmark scripts do not verify input/table/schema/row counts/reference results/checksums.

Semantics and lifecycle requirements retained

  • Native plans and actual work counters show where filters are built/probed and how many rows reach each join at SF10 and SF100.
  • Focused tests preserve exact joins, NULL-aware membership/anti joins, duplicate handling and false-positive correctness; filter generation has bounded memory and terminal cleanup.
  • Measure filtered/unfiltered and alternative build/probe controls under the same budget, including low-selectivity and build-cost negative controls.
  • Separate work-volume gains from any intrinsic hash-table gain; retain exact joins after approximate filters.

Describe implementation you've considered

Fix existing filter eligibility/placement/transmission or costed build/probe choices where supported by actual work. Preserve the exact final join and bounded filter ownership; a Bloom filter is a rejection aid, not an exact IN/NOT IN implementation.

Coordination: #30843 owns pre-aggregate restriction; #30846 owns cost per equivalent probe; #30845 owns attributed materialization.

Additional information

Pinned implementation / plan references

Activity

  1. self-assigned this
    on Oct 22, 2026
  2. added
    severity/s0
    on Oct 22, 2026
  3. aunjgr commented on Oct 31, 2026

    @aunjgr
    ContributorAuthor

    Current-main exposure gate: leading-component filter-budget candidate stopped

    Main 1565fb79ab3a230f0e383300b5be47a4b7ae6cda, local original-schema SF10, eight physical CPUs, effective 16 GiB cache and 32 GiB application budget. Cold calls were excluded. This is a diagnostic capture, not a latency acceptance result: the host CPU gate failed. All owned services exited and cleanup completed. No benchmark input/schema/table/row/reference/result/checksum verification was run; the rows below are engine EXPLAIN ANALYZE operator counters.

    Q9 still sends all 8,000,000 PARTSUPP rows to the PART/PARTSUPP join. The filtered PART side returns 108,782 keys, and the join returns 435,128 rows. That join is shuffle: range(partsupp.ps_partkey). Current generateNodeRuntimeFilter creates dependency-only shuffle specs, and HashBuild.handleRuntimeFilter publishes PASS for them. Raising the broadcast leading-component IN limit therefore cannot address this observed gap.

    Q21's large witness/order joins are also shuffled. Its smaller broadcast joins probe supplier's single-column key or lineitem's nonleading supplier key; neither exercises the proposed leading-composite-component budget change.

    Decision: stop this narrowly approved runtime-filter candidate without a production patch or optimization PR. The broader #30844 stays open. Effective shuffle-scan filtering requires its own costed delivery/ownership design; neither join-order changes nor a new distributed filter protocol are silently added to this candidate. #30842 remains deferred.

    Current Q9 physical plan
    Project
      Analyze: timeConsumed=0ms waitTime=0ms inputRows=175 outputRows=175 (min=175, max=175) InputSize=10.94 KiB OutputSize=10.94 KiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=10.94 KiB (min=10.94 KiB, max=10.94 KiB)
      ->  Sort
            Analyze: timeConsumed=0ms waitTime=0ms inputRows=175 outputRows=175 (min=175, max=175) InputSize=10.94 KiB OutputSize=10.94 KiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=21.88 KiB (min=10.94 KiB, max=10.94 KiB)
            Sort Key: profit.nation INTERNAL, profit.o_year DESC
            ->  Aggregate
                  Analyze: timeConsumed=158ms group_time=[total=158ms,min=19ms,max=20ms,dop=8] mergegroup_time=[0ms] waitTime=633ms inputRows=3261613 outputRows=175 (min=175, max=175) InputSize=186.63 MiB OutputSize=10.94 KiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=5.38 MiB (min=838.02 KiB, max=838.02 KiB)
                  Group Key: nation.n_name, extract('year', orders.o_orderdate)
                  Aggregate Functions: sum(((cast(lineitem.l_extendedprice AS DECIMAL128(15, 2)) * (1 - cast(lineitem.l_discount AS DECIMAL128(15, 2)))) - (partsupp.ps_supplycost * lineitem.l_quantity)))
                  ->  Join
                        Analyze: timeConsumed=4561ms probe_time=[total=853ms,min=97ms,max=112ms,dop=8] waitTime=3695ms inputRows=15000000 outputRows=3261613 (min=406577, max=408781) InputSize=171.66 MiB OutputSize=186.63 MiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=133.39 MiB (min=16.00 MiB, max=16.00 MiB)
                        Join Type: INNER
                        Join Cond: (orders.o_orderkey = lineitem.l_orderkey) shuffle: range(orders.o_orderkey)
                        ->  Table Scan on tpch_compare_933b9bf240e0d5d0.orders
                              Analyze: timeConsumed=332ms scan_time=[total=1ms,min=0ms,max=0ms,dop=8] filter_time=[total=331ms,min=0ms,max=42ms,dop=8] waitTime=74ms inputBlocks=1832 inputRows=15000000 outputRows=15000000 (min=1572864, max=2310144) InputSize=171.66 MiB OutputSize=171.66 MiB ReadSize=97.06 MiB|0 bytes|42.35 MiB MemorySize=356.61 MiB (min=192.00 KiB, max=43.91 MiB)
                        ->  Join
                              Analyze: timeConsumed=1861ms probe_time=[total=1813ms,min=214ms,max=234ms,dop=8] build_time=[18ms] waitTime=437ms inputRows=60421180 outputRows=3261613 (min=383713, max=426190) InputSize=2.25 GiB OutputSize=199.07 MiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=160.60 MiB (min=16.00 MiB, max=32.60 MiB)
                              Join Type: INNER   hashOnPK
                              Join Cond: (lineitem.l_suppkey = supplier.s_suppkey), (lineitem.l_partkey = part.p_partkey)
                              ->  Table Scan on tpch_compare_933b9bf240e0d5d0.lineitem
                                    Analyze: timeConsumed=7ms scan_time=[total=7ms,min=0ms,max=1ms,dop=8] waitTime=981ms inputBlocks=7324 inputRows=59986052 outputRows=59986052 (min=7077888, max=7839533) InputSize=2.23 GiB OutputSize=2.23 GiB ReadSize=1.14 GiB|0 bytes|999.46 MiB MemorySize=5.00 MiB (min=640.00 KiB, max=640.00 KiB)
                              ->  Join
                                    Analyze: timeConsumed=35ms probe_time=[total=31ms,min=3ms,max=5ms,dop=8] build_time=[2ms] waitTime=35ms inputRows=535128 outputRows=435128 (min=53672, max=55320) InputSize=9.31 MiB OutputSize=16.60 MiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=38.67 MiB (min=4.00 MiB, max=6.67 MiB)
                                    Join Type: INNER   hashOnPK
                                    Join Cond: (partsupp.ps_suppkey = supplier.s_suppkey)
                                    ->  Join
                                          Analyze: timeConsumed=261ms probe_time=[total=64ms,min=7ms,max=11ms,dop=8] waitTime=36ms inputRows=8000000 outputRows=435128 (min=53672, max=55320) InputSize=122.07 MiB OutputSize=6.64 MiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=6.18 MiB (min=512.06 KiB, max=2.15 MiB)
                                          Join Type: INNER   hashOnPK
                                          Join Cond: (partsupp.ps_partkey = part.p_partkey) shuffle: range(partsupp.ps_partkey)
                                          ->  Table Scan on tpch_compare_933b9bf240e0d5d0.partsupp
                                                Analyze: timeConsumed=0ms scan_time=[total=0ms,min=0ms,max=0ms,dop=8] waitTime=31ms inputBlocks=977 inputRows=8000000 outputRows=8000000 (min=704512, max=1368064) InputSize=122.07 MiB OutputSize=122.07 MiB ReadSize=69.08 MiB|0 bytes|8.25 MiB MemorySize=2.00 MiB (min=256.00 KiB, max=256.00 KiB)
                                          ->  Table Scan on tpch_compare_933b9bf240e0d5d0.part
                                                Analyze: timeConsumed=25ms scan_time=[total=25ms,min=3ms,max=3ms,dop=8] waitTime=17ms inputBlocks=245 inputRows=2000000 outputRows=108782 (min=12925, max=14048) InputSize=115.79 MiB OutputSize=424.93 KiB ReadSize=45.51 MiB|0 bytes|0 bytes MemorySize=5.72 MiB (min=721.16 KiB, max=736.50 KiB)
                                                Filter Cond: (part.p_name like '%green%')
                                    ->  Join
                                          Analyze: timeConsumed=2ms probe_time=[total=2ms,min=0ms,max=0ms,dop=8] build_time=[0ms] waitTime=12ms inputRows=100025 outputRows=100000 (min=1696, max=16384) InputSize=781.93 KiB OutputSize=2.67 MiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=145.25 KiB (min=16.06 KiB, max=16.75 KiB)
                                          Join Type: INNER   hashOnPK
                                          Join Cond: (supplier.s_nationkey = nation.n_nationkey)
                                          ->  Table Scan on tpch_compare_933b9bf240e0d5d0.supplier
                                                Analyze: timeConsumed=0ms scan_time=[total=0ms,min=0ms,max=0ms,dop=8] waitTime=0ms inputBlocks=13 inputRows=100000 outputRows=100000 (min=1696, max=16384) InputSize=781.25 KiB OutputSize=781.25 KiB ReadSize=544.93 KiB|0 bytes|0 bytes MemorySize=922.50 KiB (min=26.50 KiB, max=128.00 KiB)
                                          ->  Table Scan on tpch_compare_933b9bf240e0d5d0.nation
                                                Analyze: timeConsumed=0ms scan_time=[0ms,0ms] waitTime=0ms inputBlocks=1 inputRows=25 outputRows=25 (min=25, max=25) InputSize=700 bytes OutputSize=700 bytes ReadSize=465 bytes|0 bytes|0 bytes MemorySize=1.37 KiB (min=1.37 KiB, max=1.37 KiB)
    
    Current Q21 physical plan
    Project
      Analyze: timeConsumed=0ms waitTime=0ms inputRows=100 outputRows=100 (min=100, max=100) InputSize=3.12 KiB OutputSize=3.12 KiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=3.12 KiB (min=3.12 KiB, max=3.12 KiB)
      ->  Sort
            Analyze: timeConsumed=0ms waitTime=0ms inputRows=4009 outputRows=100 (min=100, max=100) InputSize=125.28 KiB OutputSize=3.12 KiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=3.12 KiB (min=3.12 KiB, max=3.12 KiB)
            Sort Key: count(*) DESC, supplier.s_name INTERNAL
            Limit: 100
            ->  Aggregate
                  Analyze: timeConsumed=5ms group_time=[total=3ms,min=0ms,max=0ms,dop=8] mergegroup_time=[0ms] waitTime=829ms inputRows=39448 outputRows=4009 (min=4009, max=4009) InputSize=924.56 KiB OutputSize=125.28 KiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=4.62 MiB (min=582.02 KiB, max=582.02 KiB)
                  Group Key: supplier.s_name
                  Aggregate Functions: starcount(1)
                  ->  Join
                        Analyze: timeConsumed=6620ms probe_time=[total=415ms,min=46ms,max=60ms,dop=8] waitTime=5792ms inputRows=59986052 outputRows=39448 (min=4808, max=5073) InputSize=686.49 MiB OutputSize=924.56 KiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=5.09 MiB (min=256.06 KiB, max=1.59 MiB)
                        Join Type: RIGHT SEMI
                        Join Cond: (l2.l_orderkey = l1.l_orderkey), (l2.l_suppkey <> l1.l_suppkey) shuffle: range(l2.l_orderkey)
                        ->  Table Scan on tpch_compare_933b9bf240e0d5d0.lineitem
                              Analyze: timeConsumed=130ms scan_time=[total=3ms,min=0ms,max=0ms,dop=8] filter_time=[total=127ms,min=0ms,max=13ms,dop=8] waitTime=327ms inputBlocks=7324 inputRows=59986052 outputRows=59986052 (min=7077888, max=7839533) InputSize=686.49 MiB OutputSize=686.49 MiB ReadSize=324.16 MiB|0 bytes|278.48 MiB MemorySize=147.53 MiB (min=192.00 KiB, max=15.96 MiB)
                        ->  Join
                              Analyze: timeConsumed=5760ms probe_time=[total=66ms,min=6ms,max=9ms,dop=8] waitTime=5226ms inputRows=7309184 outputRows=66378 (min=8174, max=8473) InputSize=55.76 MiB OutputSize=2.28 MiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=8.73 MiB (min=1.00 MiB, max=1.00 MiB)
                              Join Type: INNER
                              Join Cond: (orders.o_orderkey = l1.l_orderkey) shuffle: range(orders.o_orderkey)
                              ->  Table Scan on tpch_compare_933b9bf240e0d5d0.orders
                                    Analyze: timeConsumed=206ms scan_time=[total=206ms,min=21ms,max=32ms,dop=8] waitTime=152ms inputBlocks=1832 inputRows=15000000 outputRows=7309184 (min=764974, max=1126577) InputSize=457.76 MiB OutputSize=55.76 MiB ReadSize=87.43 MiB|0 bytes|38.15 MiB MemorySize=16.56 MiB (min=1.78 MiB, max=2.48 MiB)
                                    Filter Cond: (orders.o_orderstatus = 'F')
                              ->  Join
                                    Analyze: timeConsumed=5096ms probe_time=[total=2689ms,min=327ms,max=342ms,dop=8] waitTime=1460ms inputRows=37929348 outputRows=135716 (min=16740, max=17141) InputSize=434.07 MiB OutputSize=4.66 MiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=67.41 MiB (min=8.00 MiB, max=8.00 MiB)
                                    Join Type: RIGHT ANTI
                                    Join Cond: (l3.l_orderkey = l1.l_orderkey), (l3.l_suppkey <> l1.l_suppkey) shuffle: range(l3.l_orderkey)
                                    ->  Table Scan on tpch_compare_933b9bf240e0d5d0.lineitem
                                          Analyze: timeConsumed=352ms scan_time=[total=352ms,min=41ms,max=46ms,dop=8] waitTime=506ms inputBlocks=7324 inputRows=59986052 outputRows=37929348 (min=4475119, max=4958484) InputSize=1.12 GiB OutputSize=434.07 MiB ReadSize=620.88 MiB|0 bytes|533.38 MiB MemorySize=58.94 MiB (min=6.97 MiB, max=7.69 MiB)
                                          Filter Cond: (l3.l_receiptdate > l3.l_commitdate)
                                    ->  Join
                                          Analyze: timeConsumed=428ms probe_time=[total=428ms,min=50ms,max=56ms,dop=8] build_time=[0ms] waitTime=3ms inputRows=37933358 outputRows=1522366 (min=179708, max=198638) InputSize=434.17 MiB OutputSize=52.27 MiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=1.23 MiB (min=128.06 KiB, max=237.71 KiB)
                                          Join Type: INNER   hashOnPK
                                          Join Cond: (l1.l_suppkey = supplier.s_suppkey)
                                          ->  Table Scan on tpch_compare_933b9bf240e0d5d0.lineitem
                                                Analyze: timeConsumed=347ms scan_time=[total=347ms,min=40ms,max=45ms,dop=8] waitTime=502ms inputBlocks=7324 inputRows=59986052 outputRows=37929348 (min=4475119, max=4958484) InputSize=1.12 GiB OutputSize=434.07 MiB ReadSize=620.88 MiB|0 bytes|533.38 MiB MemorySize=58.94 MiB (min=6.97 MiB, max=7.69 MiB)
                                                Filter Cond: (l1.l_receiptdate > l1.l_commitdate)
                                          ->  Join
                                                Analyze: timeConsumed=1ms probe_time=[total=1ms,min=0ms,max=0ms,dop=8] build_time=[0ms] waitTime=1ms inputRows=100001 outputRows=4010 (min=80, max=672) InputSize=3.05 MiB OutputSize=109.65 KiB ReadSize=0 bytes|0 bytes|0 bytes MemorySize=144.58 KiB (min=16.06 KiB, max=16.07 KiB)
                                                Join Type: INNER   hashOnPK
                                                Join Cond: (supplier.s_nationkey = nation.n_nationkey)
                                                ->  Table Scan on tpch_compare_933b9bf240e0d5d0.supplier
                                                      Analyze: timeConsumed=0ms scan_time=[total=0ms,min=0ms,max=0ms,dop=8] waitTime=0ms inputBlocks=13 inputRows=100000 outputRows=100000 (min=1696, max=16384) InputSize=3.05 MiB OutputSize=3.05 MiB ReadSize=1.02 MiB|0 bytes|0 bytes MemorySize=3.60 MiB (min=106.00 KiB, max=512.00 KiB)
                                                ->  Table Scan on tpch_compare_933b9bf240e0d5d0.nation
                                                      Analyze: timeConsumed=0ms scan_time=[0ms,0ms] waitTime=0ms inputBlocks=1 inputRows=25 outputRows=1 (min=1, max=1) InputSize=700 bytes OutputSize=4 bytes ReadSize=465 bytes|0 bytes|0 bytes MemorySize=729 bytes (min=729 bytes, max=729 bytes)
                                                      Filter Cond: (nation.n_name = 'SAUDI ARABIA')
    
  4. XuPeng-SH commented on Nov 10, 2026

    @XuPeng-SH
    Contributor

    合并范围记录:PR #32098 已于 2026-11-10 01:16 UTC 合入 main,SHA de2790be20948f9d99cb833ddbbaa8a792b7a2ac。它实现独立过滤主键扫描的完整 local key domain,在符合条件的未过滤本地扫描中于 shuffle/probe 前拒绝不可能匹配的整数键;保留精确 join、join order 与 placement,不改变 build/probe 方向。已有 row/block/runtime filter 的 reader 仍走原路径,其组合属于后续 reader integration。

    作者对 replacement 的 source-pinned SF10/SF100 结果见 #32098 (comment) 和 #32098 (comment) 。这些结果报告 Q9 收益及声明的全查询/Total gate 通过;不是旧 shuffle-only 版本的验收,也不是本次对 merge SHA 的本地复测。作者另保留 SF100 memory Q17 原始区间的变慢信号及未达 Holm gate 的限制,见 #32098 (comment) 。

    本 issue 仍覆盖更广的 Q9/Q21、scale-specific Q17、过滤传递及替代 build/probe 选择;此次合并是其中一部分,不能据此把整个工单标为开发完成或验收通过。保留 aunjgr 与 open 状态,不整项转测。本轮仅核对远端合并信息、issue 全部评论及 PR 的范围/证据记录,未运行本地测试。

  5. 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/subtaskseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions