Skip to content

perf: Convert inner joins to semi joins when equivalent#22652

Open
neilconway wants to merge 6 commits into
apache:mainfrom
neilconway:neilc/perf-fd-convert-to-semi-join
Open

perf: Convert inner joins to semi joins when equivalent#22652
neilconway wants to merge 6 commits into
apache:mainfrom
neilconway:neilc/perf-fd-convert-to-semi-join

Conversation

@neilconway
Copy link
Copy Markdown
Contributor

@neilconway neilconway commented May 30, 2026

Which issue does this PR close?

Rationale for this change

This PR extends the EliminateJoin rewrite pass to replace inner joins with semi joins in some cases. An inner join L ⋈ R can be rewritten to a left semi join L ⋉ R if two conditions hold:

  1. None of R's columns are referenced above the join
  2. (a) each L row matches at most one R row, OR (b) the consumers of the join result are insensitive to duplicates

(And symmetrically with right semi joins.)

What changes are included in this PR?

  • Add for_each_referenced_index helper that is used by both EliminateJoin and EliminateProjections
  • Introduce LiveColumns type to track the live (referenced by parent) columns of a plan node
  • Add inner -> semi join rewrite to EliminateJoin
  • Add unit and SLT tests for rewrite behavior
  • Update SLT test fixtures for plan changes

Are these changes tested?

Yes; new tests added.

Are there any user-facing changes?

Some plan changes but no behavioral changes.

@neilconway
Copy link
Copy Markdown
Contributor Author

run benchmarks tpcds

@github-actions github-actions Bot added optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt) labels May 30, 2026
@adriangbot
Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4583581776-374-57xj4 6.12.68+ #1 SMP Wed Apr 1 02:23:28 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected

Comparing neilc/perf-fd-convert-to-semi-join (39eb398) to 2e7b8e1 (merge-base) diff using: tpcds
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot
Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected
Details

Comparing HEAD and neilc_perf-fd-convert-to-semi-join
--------------------
Benchmark tpcds_sf1.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query     ┃                                  HEAD ┃    neilc_perf-fd-convert-to-semi-join ┃        Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1  │           5.88 / 6.36 ±0.87 / 8.09 ms │           5.88 / 6.37 ±0.84 / 8.04 ms │     no change │
│ QQuery 2  │        83.85 / 84.09 ±0.16 / 84.34 ms │        81.07 / 81.37 ±0.30 / 81.93 ms │     no change │
│ QQuery 3  │        29.21 / 29.38 ±0.15 / 29.57 ms │        28.93 / 29.19 ±0.24 / 29.64 ms │     no change │
│ QQuery 4  │     500.03 / 505.73 ±3.64 / 509.52 ms │     500.62 / 508.07 ±4.31 / 512.96 ms │     no change │
│ QQuery 5  │        51.79 / 52.37 ±0.58 / 53.39 ms │        52.02 / 52.45 ±0.31 / 52.81 ms │     no change │
│ QQuery 6  │        36.90 / 37.30 ±0.22 / 37.56 ms │        36.71 / 37.35 ±0.34 / 37.69 ms │     no change │
│ QQuery 7  │       95.53 / 99.00 ±4.83 / 108.52 ms │       95.18 / 97.20 ±3.27 / 103.71 ms │     no change │
│ QQuery 8  │        37.41 / 37.74 ±0.21 / 38.02 ms │        37.33 / 37.87 ±0.41 / 38.53 ms │     no change │
│ QQuery 9  │        52.94 / 55.44 ±1.39 / 56.69 ms │        54.46 / 55.28 ±1.34 / 57.95 ms │     no change │
│ QQuery 10 │        69.05 / 69.65 ±0.34 / 70.10 ms │        71.19 / 71.41 ±0.20 / 71.72 ms │     no change │
│ QQuery 11 │     305.57 / 308.21 ±1.54 / 309.77 ms │     312.30 / 314.57 ±1.43 / 316.52 ms │     no change │
│ QQuery 12 │        28.79 / 29.05 ±0.30 / 29.64 ms │        28.73 / 29.19 ±0.28 / 29.52 ms │     no change │
│ QQuery 13 │     119.82 / 121.61 ±1.64 / 123.63 ms │     119.62 / 120.65 ±0.99 / 122.35 ms │     no change │
│ QQuery 14 │    503.08 / 512.86 ±12.20 / 536.80 ms │     434.41 / 436.01 ±1.15 / 437.98 ms │ +1.18x faster │
│ QQuery 15 │        59.46 / 61.70 ±2.44 / 66.41 ms │        60.27 / 60.73 ±0.35 / 61.21 ms │     no change │
│ QQuery 16 │          6.72 / 7.76 ±1.60 / 10.90 ms │           6.89 / 7.10 ±0.25 / 7.56 ms │ +1.09x faster │
│ QQuery 17 │        80.81 / 81.89 ±1.26 / 84.04 ms │        80.43 / 82.52 ±2.07 / 86.12 ms │     no change │
│ QQuery 18 │     125.26 / 126.59 ±0.90 / 127.44 ms │     125.61 / 127.33 ±1.02 / 128.34 ms │     no change │
│ QQuery 19 │        42.09 / 42.32 ±0.14 / 42.46 ms │        41.98 / 42.84 ±0.74 / 44.22 ms │     no change │
│ QQuery 20 │        36.32 / 36.75 ±0.31 / 37.11 ms │        35.98 / 38.05 ±2.50 / 42.92 ms │     no change │
│ QQuery 21 │        17.12 / 17.45 ±0.25 / 17.71 ms │        17.27 / 17.60 ±0.22 / 17.95 ms │     no change │
│ QQuery 22 │        63.23 / 63.65 ±0.34 / 64.18 ms │        63.17 / 63.78 ±0.39 / 64.34 ms │     no change │
│ QQuery 23 │     481.60 / 486.16 ±3.31 / 490.47 ms │     475.13 / 484.22 ±5.97 / 493.00 ms │     no change │
│ QQuery 24 │     223.93 / 228.08 ±4.13 / 235.57 ms │    226.76 / 234.79 ±10.07 / 253.97 ms │     no change │
│ QQuery 25 │     113.59 / 117.62 ±6.79 / 131.17 ms │     114.98 / 117.61 ±1.82 / 120.52 ms │     no change │
│ QQuery 26 │        58.99 / 59.44 ±0.33 / 59.94 ms │        58.59 / 61.74 ±3.89 / 67.77 ms │     no change │
│ QQuery 27 │           6.61 / 6.73 ±0.15 / 7.02 ms │           6.90 / 7.03 ±0.16 / 7.35 ms │     no change │
│ QQuery 28 │        61.39 / 61.63 ±0.19 / 61.86 ms │        57.64 / 60.32 ±1.91 / 62.38 ms │     no change │
│ QQuery 29 │      98.49 / 102.20 ±3.46 / 107.67 ms │       98.19 / 99.99 ±1.75 / 103.35 ms │     no change │
│ QQuery 30 │        33.01 / 33.38 ±0.52 / 34.40 ms │        33.58 / 36.53 ±2.37 / 40.55 ms │  1.09x slower │
│ QQuery 31 │     111.53 / 112.43 ±0.48 / 112.85 ms │     113.46 / 114.95 ±1.43 / 117.55 ms │     no change │
│ QQuery 32 │        20.57 / 21.58 ±1.22 / 23.94 ms │        20.79 / 21.07 ±0.26 / 21.56 ms │     no change │
│ QQuery 33 │        38.55 / 38.81 ±0.28 / 39.35 ms │        38.74 / 39.09 ±0.27 / 39.53 ms │     no change │
│ QQuery 34 │         9.87 / 10.26 ±0.34 / 10.86 ms │         9.84 / 11.89 ±3.76 / 19.39 ms │  1.16x slower │
│ QQuery 35 │        77.99 / 78.72 ±0.50 / 79.56 ms │        84.74 / 86.94 ±3.04 / 92.92 ms │  1.10x slower │
│ QQuery 36 │           5.83 / 5.96 ±0.16 / 6.28 ms │           6.05 / 6.18 ±0.16 / 6.48 ms │     no change │
│ QQuery 37 │           6.86 / 7.03 ±0.16 / 7.32 ms │           6.93 / 7.27 ±0.33 / 7.88 ms │     no change │
│ QQuery 38 │        63.49 / 65.37 ±1.87 / 68.54 ms │        65.30 / 66.24 ±0.97 / 67.95 ms │     no change │
│ QQuery 39 │       98.95 / 99.87 ±0.58 / 100.54 ms │     103.03 / 105.71 ±2.56 / 110.27 ms │  1.06x slower │
│ QQuery 40 │        23.35 / 23.59 ±0.13 / 23.72 ms │        23.88 / 24.47 ±0.35 / 24.90 ms │     no change │
│ QQuery 41 │        11.59 / 11.83 ±0.16 / 12.03 ms │        11.96 / 12.10 ±0.08 / 12.19 ms │     no change │
│ QQuery 42 │        24.11 / 24.50 ±0.28 / 24.82 ms │        24.50 / 24.77 ±0.36 / 25.44 ms │     no change │
│ QQuery 43 │           4.84 / 4.96 ±0.13 / 5.22 ms │           4.88 / 5.00 ±0.12 / 5.23 ms │     no change │
│ QQuery 44 │        10.79 / 12.36 ±2.91 / 18.18 ms │        10.92 / 10.97 ±0.05 / 11.06 ms │ +1.13x faster │
│ QQuery 45 │        39.07 / 40.63 ±1.55 / 43.28 ms │        39.80 / 40.11 ±0.28 / 40.51 ms │     no change │
│ QQuery 46 │        12.23 / 12.45 ±0.21 / 12.78 ms │        11.88 / 13.43 ±1.84 / 16.96 ms │  1.08x slower │
│ QQuery 47 │     236.87 / 242.06 ±6.08 / 253.35 ms │     239.01 / 244.23 ±5.06 / 252.86 ms │     no change │
│ QQuery 48 │        98.09 / 98.74 ±0.57 / 99.56 ms │        97.78 / 98.31 ±0.65 / 99.55 ms │     no change │
│ QQuery 49 │        77.60 / 80.15 ±3.96 / 88.03 ms │        78.68 / 84.07 ±6.05 / 94.48 ms │     no change │
│ QQuery 50 │        58.93 / 59.65 ±0.43 / 60.20 ms │        60.10 / 61.31 ±0.76 / 62.32 ms │     no change │
│ QQuery 51 │        92.69 / 95.75 ±2.80 / 99.57 ms │        95.04 / 96.05 ±0.83 / 96.94 ms │     no change │
│ QQuery 52 │        24.40 / 25.09 ±0.66 / 25.96 ms │        24.72 / 25.41 ±0.88 / 27.03 ms │     no change │
│ QQuery 53 │        30.03 / 30.37 ±0.22 / 30.62 ms │        29.97 / 31.87 ±3.36 / 38.57 ms │     no change │
│ QQuery 54 │        56.56 / 56.87 ±0.46 / 57.76 ms │        67.14 / 68.60 ±0.98 / 70.02 ms │  1.21x slower │
│ QQuery 55 │        24.01 / 24.30 ±0.32 / 24.93 ms │        24.05 / 24.48 ±0.35 / 25.07 ms │     no change │
│ QQuery 56 │        38.77 / 39.31 ±0.56 / 40.16 ms │        39.72 / 39.81 ±0.06 / 39.86 ms │     no change │
│ QQuery 57 │     176.71 / 179.38 ±3.17 / 185.17 ms │     179.72 / 183.21 ±4.55 / 192.18 ms │     no change │
│ QQuery 58 │     119.83 / 120.49 ±0.60 / 121.42 ms │     118.81 / 120.45 ±1.81 / 123.80 ms │     no change │
│ QQuery 59 │     120.57 / 121.68 ±1.96 / 125.58 ms │     118.02 / 118.45 ±0.40 / 119.07 ms │     no change │
│ QQuery 60 │        39.05 / 39.90 ±0.73 / 41.10 ms │        39.64 / 41.26 ±2.14 / 45.48 ms │     no change │
│ QQuery 61 │        12.51 / 12.63 ±0.11 / 12.82 ms │        12.89 / 12.99 ±0.09 / 13.11 ms │     no change │
│ QQuery 62 │        46.03 / 46.50 ±0.35 / 47.04 ms │        46.89 / 47.23 ±0.27 / 47.59 ms │     no change │
│ QQuery 63 │        30.00 / 30.29 ±0.16 / 30.46 ms │        29.78 / 29.88 ±0.11 / 30.07 ms │     no change │
│ QQuery 64 │    395.34 / 406.51 ±10.69 / 420.20 ms │    308.27 / 323.70 ±11.92 / 337.79 ms │ +1.26x faster │
│ QQuery 65 │     144.94 / 147.69 ±2.22 / 151.74 ms │     142.76 / 144.02 ±0.90 / 145.42 ms │     no change │
│ QQuery 66 │        79.42 / 79.91 ±0.38 / 80.45 ms │        80.80 / 85.56 ±5.80 / 95.81 ms │  1.07x slower │
│ QQuery 67 │     253.59 / 260.67 ±4.66 / 267.38 ms │     258.21 / 263.86 ±5.75 / 271.13 ms │     no change │
│ QQuery 68 │        11.85 / 12.00 ±0.18 / 12.35 ms │        11.90 / 12.06 ±0.12 / 12.21 ms │     no change │
│ QQuery 69 │        63.66 / 64.05 ±0.34 / 64.53 ms │        65.01 / 71.70 ±7.31 / 81.31 ms │  1.12x slower │
│ QQuery 70 │     107.16 / 114.79 ±6.73 / 124.33 ms │     106.61 / 111.06 ±4.50 / 119.53 ms │     no change │
│ QQuery 71 │        36.04 / 36.53 ±0.70 / 37.90 ms │        35.15 / 35.79 ±0.43 / 36.34 ms │     no change │
│ QQuery 72 │ 2136.47 / 2205.41 ±52.63 / 2277.75 ms │ 2149.93 / 2231.16 ±53.78 / 2319.41 ms │     no change │
│ QQuery 73 │          9.54 / 9.85 ±0.21 / 10.05 ms │         9.35 / 11.90 ±4.72 / 21.34 ms │  1.21x slower │
│ QQuery 74 │     183.88 / 188.42 ±5.31 / 198.16 ms │     174.42 / 180.76 ±4.96 / 189.73 ms │     no change │
│ QQuery 75 │     149.99 / 153.48 ±3.75 / 160.62 ms │     149.13 / 151.48 ±2.51 / 156.00 ms │     no change │
│ QQuery 76 │        36.58 / 39.16 ±4.44 / 48.02 ms │        35.72 / 36.11 ±0.23 / 36.33 ms │ +1.08x faster │
│ QQuery 77 │        60.22 / 60.88 ±0.54 / 61.49 ms │        61.38 / 65.48 ±3.93 / 70.57 ms │  1.08x slower │
│ QQuery 78 │     190.21 / 195.04 ±4.34 / 202.86 ms │     189.67 / 196.82 ±7.47 / 210.91 ms │     no change │
│ QQuery 79 │        67.77 / 67.98 ±0.30 / 68.59 ms │        67.78 / 68.22 ±0.40 / 68.74 ms │     no change │
│ QQuery 80 │     101.04 / 103.35 ±1.85 / 106.43 ms │     100.83 / 101.81 ±0.96 / 103.45 ms │     no change │
│ QQuery 81 │        25.80 / 26.14 ±0.19 / 26.39 ms │        26.47 / 29.22 ±4.49 / 38.11 ms │  1.12x slower │
│ QQuery 82 │        16.68 / 17.37 ±1.06 / 19.48 ms │        16.35 / 17.18 ±0.95 / 18.98 ms │     no change │
│ QQuery 83 │        39.57 / 39.95 ±0.32 / 40.49 ms │        40.51 / 41.24 ±0.51 / 41.86 ms │     no change │
│ QQuery 84 │        34.73 / 35.18 ±0.35 / 35.68 ms │        35.21 / 35.43 ±0.19 / 35.71 ms │     no change │
│ QQuery 85 │     110.43 / 115.52 ±4.98 / 123.79 ms │     108.81 / 111.55 ±4.37 / 120.24 ms │     no change │
│ QQuery 86 │        25.22 / 25.78 ±0.29 / 26.06 ms │        25.39 / 25.66 ±0.22 / 25.93 ms │     no change │
│ QQuery 87 │        64.65 / 66.07 ±2.11 / 70.28 ms │        66.99 / 67.64 ±0.52 / 68.53 ms │     no change │
│ QQuery 88 │        62.75 / 63.31 ±0.51 / 64.07 ms │        62.22 / 62.99 ±0.54 / 63.84 ms │     no change │
│ QQuery 89 │        35.64 / 35.97 ±0.17 / 36.11 ms │        36.43 / 37.98 ±1.78 / 41.46 ms │  1.06x slower │
│ QQuery 90 │        17.13 / 17.24 ±0.06 / 17.32 ms │        17.30 / 17.48 ±0.19 / 17.83 ms │     no change │
│ QQuery 91 │        45.59 / 45.99 ±0.26 / 46.28 ms │        45.46 / 45.93 ±0.29 / 46.21 ms │     no change │
│ QQuery 92 │        29.37 / 30.11 ±0.41 / 30.59 ms │        30.37 / 30.95 ±0.32 / 31.23 ms │     no change │
│ QQuery 93 │        51.68 / 52.05 ±0.20 / 52.28 ms │        52.11 / 52.69 ±0.42 / 53.39 ms │     no change │
│ QQuery 94 │        38.62 / 39.09 ±0.32 / 39.56 ms │        40.01 / 42.38 ±2.48 / 45.47 ms │  1.08x slower │
│ QQuery 95 │        83.71 / 84.33 ±0.39 / 84.92 ms │        84.08 / 85.97 ±1.74 / 88.75 ms │     no change │
│ QQuery 96 │        24.19 / 24.47 ±0.20 / 24.68 ms │        24.56 / 24.88 ±0.18 / 25.05 ms │     no change │
│ QQuery 97 │        45.66 / 48.20 ±2.01 / 51.09 ms │        50.21 / 50.64 ±0.28 / 50.95 ms │  1.05x slower │
│ QQuery 98 │        42.61 / 43.75 ±0.78 / 44.93 ms │        43.08 / 45.25 ±1.99 / 48.82 ms │     no change │
│ QQuery 99 │        70.10 / 70.41 ±0.19 / 70.65 ms │        70.47 / 70.85 ±0.28 / 71.17 ms │     no change │
└───────────┴───────────────────────────────────────┴───────────────────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                                 ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                                 │ 10382.31ms │
│ Total Time (neilc_perf-fd-convert-to-semi-join)   │ 10324.36ms │
│ Average Time (HEAD)                               │   104.87ms │
│ Average Time (neilc_perf-fd-convert-to-semi-join) │   104.29ms │
│ Queries Faster                                    │          5 │
│ Queries Slower                                    │         14 │
│ Queries with No Change                            │         80 │
│ Queries with Failure                              │          0 │
└───────────────────────────────────────────────────┴────────────┘

Resource Usage

tpcds — base (merge-base)

Metric Value
Wall time 55.0s
Peak memory 7.0 GiB
Avg memory 6.3 GiB
CPU user 239.6s
CPU sys 6.8s
Peak spill 0 B

tpcds — branch

Metric Value
Wall time 55.0s
Peak memory 6.9 GiB
Avg memory 6.0 GiB
CPU user 240.8s
CPU sys 7.0s
Peak spill 0 B

File an issue against this benchmark runner

@neilconway neilconway marked this pull request as ready for review May 31, 2026 13:33
Comment on lines +80 to +83
/// The columns that are "live" at a plan node, i.e., which of its output
/// columns are referenced by an ancestor node. Represented as a set of column
/// indices, relative to the node's schema.
type LiveColumns = HashSet<usize>;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. This is similar but not identical to the RequiredIndices data structure used by OptimizeProjections. RequiredIndices cares about insertion order but we don't, so it seemed cleaner to use a different data structure here.
  2. It would be better to use a bitmap than a HashSet. We could do so by adding a dependency on a third-party bitmap implementation (e.g., https://github.com/petgraph/fixedbitset, which one of our indirect dependencies already pulls in). But the performance impact should be small, so I'm not sure it's worth adding the dep.

@neilconway
Copy link
Copy Markdown
Contributor Author

Digging into some of the TPC-DS query plan changes, we ran into two different planner bugs: #22679 and #22674. This PR will also benefit (on TPC-DS and TPC-H) from landing #22646

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize inner joins to semi joins when possible

2 participants