Skip to content

perf: Merge Precision in-place - #21219

Merged
alamb merged 3 commits into
apache:mainfrom
AdamGS:adamg/stats-in-place-min-max
Apr 3, 2026
Merged

perf: Merge Precision in-place#21219
alamb merged 3 commits into
apache:mainfrom
AdamGS:adamg/stats-in-place-min-max

Conversation

@AdamGS

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Follow up of #20768.

Rationale for this change

Precision::min/max allocates a lot of new ScalarValues, and it can be done in place.
While running the sql_planner benchmark, it seems like for clickbench Statistics::try_merge_iter is a significant part of the runtime, and this PR improves that part by about 20-25% locally.

What changes are included in this PR?

Introduces a couple of of new internal functions to calculate the min/max of a Precision in-place.

Are these changes tested?

Existing general tests, and a few new unit tests.

Are there any user-facing changes?

None

@github-actionsgithub-actionsBot added the common Related to common crate label Mar 28, 2026
@AdamGS

AdamGS commented Mar 28, 2026

Copy link
Copy Markdown
ContributorAuthor

Locally, the perf impact on the stats_merge benchmark is:

stats_merge/try_merge_iter/10parts_1cols
time: [261.85 ns 263.02 ns 264.27 ns]
change: [−20.578% −20.212% −19.831%] (p = 0.00 < 0.05)
Performance has improved.
Benchmarking stats_merge/try_merge_iter/10parts_5cols: Collecting 100 samples in estimatedstats_merge/try_merge_iter/10parts_5cols
time: [1.1278 µs 1.1310 µs 1.1346 µs]
change: [−18.151% −17.782% −17.421%] (p = 0.00 < 0.05)
Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
3 (3.00%) high mild
6 (6.00%) high severe
Benchmarking stats_merge/try_merge_iter/10parts_20cols: Collecting 100 samples in estimatestats_merge/try_merge_iter/10parts_20cols
time: [4.1735 µs 4.1785 µs 4.1843 µs]
change: [−18.384% −18.204% −18.034%] (p = 0.00 < 0.05)
Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
3 (3.00%) high mild
5 (5.00%) high severe
Benchmarking stats_merge/try_merge_iter/100parts_1cols: Collecting 100 samples in estimatestats_merge/try_merge_iter/100parts_1cols
time: [2.2418 µs 2.2478 µs 2.2547 µs]
change: [−22.768% −22.464% −22.154%] (p = 0.00 < 0.05)
Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
6 (6.00%) high mild
4 (4.00%) high severe
Benchmarking stats_merge/try_merge_iter/100parts_5cols: Collecting 100 samples in estimatestats_merge/try_merge_iter/100parts_5cols
time: [11.596 µs 11.628 µs 11.665 µs]
change: [−14.560% −14.268% −13.925%] (p = 0.00 < 0.05)
Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) high mild
1 (1.00%) high severe
Benchmarking stats_merge/try_merge_iter/100parts_20cols: Collecting 100 samples in estimatstats_merge/try_merge_iter/100parts_20cols
time: [43.707 µs 43.818 µs 43.949 µs]
change: [−16.318% −16.016% −15.691%] (p = 0.00 < 0.05)
Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
1 (1.00%) high mild
2 (2.00%) high severe
Benchmarking stats_merge/try_merge_iter/500parts_1cols: Collecting 100 samples in estimatestats_merge/try_merge_iter/500parts_1cols
time: [11.530 µs 11.559 µs 11.591 µs]
change: [−23.035% −22.749% −22.473%] (p = 0.00 < 0.05)
Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
5 (5.00%) high mild
1 (1.00%) high severe
Benchmarking stats_merge/try_merge_iter/500parts_5cols: Collecting 100 samples in estimatestats_merge/try_merge_iter/500parts_5cols
time: [57.852 µs 58.011 µs 58.178 µs]
change: [−15.960% −15.588% −15.191%] (p = 0.00 < 0.05)
Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
5 (5.00%) high mild
2 (2.00%) high severe
Benchmarking stats_merge/try_merge_iter/500parts_20cols: Collecting 100 samples in estimatstats_merge/try_merge_iter/500parts_20cols
time: [220.48 µs 221.23 µs 222.16 µs]
change: [−13.692% −13.092% −12.313%] (p = 0.00 < 0.05)
Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
1 (1.00%) high mild
2 (2.00%) high severe

@AdamGS
AdamGSforce-pushed the adamg/stats-in-place-min-max branch from 8324b4d to e4f4dbaCompareMarch 28, 2026 19:18
Signed-off-by: Adam Gutglick <adamgsal@gmail.com>
@AdamGS
AdamGSforce-pushed the adamg/stats-in-place-min-max branch from e4f4dba to 4e420d6CompareApril 1, 2026 11:17
Signed-off-by: Adam Gutglick <adamgsal@gmail.com>
@alamb

alamb commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

run benchmark stats_merge

@alamb

alamb commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

run benchmark sql_planner

@adriangbot

Copy link
Copy Markdown

🤖 Criterion benchmark running (GKE) | trigger
Instance:c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4180550309-683-mv5q5 6.12.55+ #1 SMP Sun Feb 1 08:59:41 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 adamg/stats-in-place-min-max (2fb0a43) to bc2b36c (merge-base) diff
BENCH_NAME=stats_merge
BENCH_COMMAND=cargo bench --features=parquet --bench stats_merge
BENCH_FILTER=
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Criterion benchmark running (GKE) | trigger
Instance:c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4180550651-684-dlbfv 6.12.55+ #1 SMP Sun Feb 1 08:59:41 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 adamg/stats-in-place-min-max (2fb0a43) to bc2b36c (merge-base) diff
BENCH_NAME=sql_planner
BENCH_COMMAND=cargo bench --features=parquet --bench sql_planner
BENCH_FILTER=
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Criterion 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

group adamg_stats-in-place-min-max main
----- ---------------------------- ----
stats_merge/try_merge_iter/100parts_1cols 1.00 4.1±0.06µs ? ?/sec 1.28 5.2±0.17µs ? ?/sec
stats_merge/try_merge_iter/100parts_20cols 1.00 80.4±0.82µs ? ?/sec 1.30 104.1±4.70µs ? ?/sec
stats_merge/try_merge_iter/100parts_5cols 1.00 20.4±0.21µs ? ?/sec 1.31 26.7±1.10µs ? ?/sec
stats_merge/try_merge_iter/10parts_1cols 1.00 439.4±8.82ns ? ?/sec 1.24 546.3±13.36ns ? ?/sec
stats_merge/try_merge_iter/10parts_20cols 1.00 8.3±0.08µs ? ?/sec 1.20 10.0±0.29µs ? ?/sec
stats_merge/try_merge_iter/10parts_5cols 1.00 2.2±0.03µs ? ?/sec 1.21 2.6±0.07µs ? ?/sec
stats_merge/try_merge_iter/500parts_1cols 1.00 20.2±0.26µs ? ?/sec 1.32 26.7±0.83µs ? ?/sec
stats_merge/try_merge_iter/500parts_20cols 1.00 409.5±3.86µs ? ?/sec 1.31 535.9±22.19µs ? ?/sec
stats_merge/try_merge_iter/500parts_5cols 1.00 101.8±1.02µs ? ?/sec 1.32 134.5±5.68µs ? ?/sec

Resource Usage

base (merge-base)

MetricValue
Wall time89.8s
Peak memory3.3 GiB
Avg memory3.3 GiB
CPU user109.9s
CPU sys1.1s
Disk read0 B
Disk write544.7 MiB

branch

MetricValue
Wall time88.8s
Peak memory3.3 GiB
Avg memory3.3 GiB
CPU user111.0s
CPU sys0.2s
Disk read0 B
Disk write10.0 MiB

File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Criterion 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

group adamg_stats-in-place-min-max main
----- ---------------------------- ----
logical_aggregate_with_join 1.03 446.0±1.19µs ? ?/sec 1.00 433.9±1.02µs ? ?/sec
logical_plan_struct_join_agg_sort 1.00 174.1±0.98µs ? ?/sec 1.00 173.4±0.94µs ? ?/sec
logical_select_all_from_1000 1.05 8.6±0.04ms ? ?/sec 1.00 8.2±0.03ms ? ?/sec
logical_select_one_from_700 1.01 322.1±1.18µs ? ?/sec 1.00 319.5±1.21µs ? ?/sec
logical_trivial_join_high_numbered_columns 1.01 269.5±0.58µs ? ?/sec 1.00 266.2±0.54µs ? ?/sec
logical_trivial_join_low_numbered_columns 1.01 257.1±0.79µs ? ?/sec 1.00 254.2±0.74µs ? ?/sec
physical_intersection 1.01 601.8±3.44µs ? ?/sec 1.00 595.4±4.91µs ? ?/sec
physical_join_consider_sort 1.02 1043.8±2.43µs ? ?/sec 1.00 1023.4±3.82µs ? ?/sec
physical_join_distinct 1.01 252.0±1.21µs ? ?/sec 1.00 249.2±1.31µs ? ?/sec
physical_many_self_joins 1.04 7.8±0.04ms ? ?/sec 1.00 7.5±0.02ms ? ?/sec
physical_plan_clickbench_all 1.00 103.6±0.39ms ? ?/sec 1.06 109.9±0.67ms ? ?/sec
physical_plan_clickbench_q1 1.00 1018.2±4.98µs ? ?/sec 1.13 1146.6±13.20µs ? ?/sec
physical_plan_clickbench_q10 1.00 1658.5±6.06µs ? ?/sec 1.10 1818.7±11.34µs ? ?/sec
physical_plan_clickbench_q11 1.00 1821.5±38.61µs ? ?/sec 1.07 1948.1±11.19µs ? ?/sec
physical_plan_clickbench_q12 1.00 1959.9±103.51µs ? ?/sec 1.04 2.0±0.02ms ? ?/sec
physical_plan_clickbench_q13 1.00 1673.4±21.41µs ? ?/sec 1.08 1811.4±12.55µs ? ?/sec
physical_plan_clickbench_q14 1.00 1829.1±34.28µs ? ?/sec 1.08 1969.0±17.81µs ? ?/sec
physical_plan_clickbench_q15 1.00 1694.9±23.85µs ? ?/sec 1.07 1817.6±15.90µs ? ?/sec
physical_plan_clickbench_q16 1.00 1377.9±6.88µs ? ?/sec 1.11 1525.6±16.28µs ? ?/sec
physical_plan_clickbench_q17 1.00 1433.5±9.20µs ? ?/sec 1.10 1577.8±11.21µs ? ?/sec
physical_plan_clickbench_q18 1.00 1268.5±6.65µs ? ?/sec 1.11 1414.3±11.66µs ? ?/sec
physical_plan_clickbench_q19 1.00 1658.9±9.77µs ? ?/sec 1.09 1802.0±11.25µs ? ?/sec
physical_plan_clickbench_q2 1.00 1348.6±6.59µs ? ?/sec 1.13 1525.5±11.69µs ? ?/sec
physical_plan_clickbench_q20 1.00 1086.0±5.60µs ? ?/sec 1.16 1255.0±11.32µs ? ?/sec
physical_plan_clickbench_q21 1.00 1348.8±8.62µs ? ?/sec 1.11 1499.6±12.63µs ? ?/sec
physical_plan_clickbench_q22 1.00 1754.2±7.26µs ? ?/sec 1.09 1909.6±18.46µs ? ?/sec
physical_plan_clickbench_q23 1.00 1946.4±5.71µs ? ?/sec 1.08 2.1±0.01ms ? ?/sec
physical_plan_clickbench_q24 1.00 2.9±0.01ms ? ?/sec 1.04 3.1±0.01ms ? ?/sec
physical_plan_clickbench_q25 1.00 1457.1±5.50µs ? ?/sec 1.12 1631.6±10.86µs ? ?/sec
physical_plan_clickbench_q26 1.00 1297.9±5.80µs ? ?/sec 1.10 1434.0±12.66µs ? ?/sec
physical_plan_clickbench_q27 1.00 1478.1±9.92µs ? ?/sec 1.09 1616.7±11.78µs ? ?/sec
physical_plan_clickbench_q28 1.00 1938.0±17.37µs ? ?/sec 1.06 2.1±0.01ms ? ?/sec
physical_plan_clickbench_q29 1.00 2.1±0.01ms ? ?/sec 1.06 2.2±0.01ms ? ?/sec
physical_plan_clickbench_q3 1.00 1265.9±5.72µs ? ?/sec 1.13 1424.3±11.74µs ? ?/sec
physical_plan_clickbench_q30 1.01 16.1±0.13ms ? ?/sec 1.00 16.0±0.07ms ? ?/sec
physical_plan_clickbench_q31 1.00 2.1±0.01ms ? ?/sec 1.05 2.2±0.01ms ? ?/sec
physical_plan_clickbench_q32 1.00 2.1±0.01ms ? ?/sec 1.05 2.2±0.01ms ? ?/sec
physical_plan_clickbench_q33 1.00 1673.4±5.65µs ? ?/sec 1.07 1788.0±11.69µs ? ?/sec
physical_plan_clickbench_q34 1.00 1390.8±5.47µs ? ?/sec 1.13 1568.3±11.04µs ? ?/sec
physical_plan_clickbench_q35 1.00 1461.2±6.05µs ? ?/sec 1.12 1629.6±11.31µs ? ?/sec
physical_plan_clickbench_q36 1.00 1787.0±6.43µs ? ?/sec 1.09 1943.8±11.55µs ? ?/sec
physical_plan_clickbench_q37 1.00 2.2±0.01ms ? ?/sec 1.08 2.3±0.01ms ? ?/sec
physical_plan_clickbench_q38 1.00 2.1±0.01ms ? ?/sec 1.08 2.3±0.01ms ? ?/sec
physical_plan_clickbench_q39 1.00 2.0±0.01ms ? ?/sec 1.08 2.2±0.01ms ? ?/sec
physical_plan_clickbench_q4 1.00 1070.2±5.51µs ? ?/sec 1.16 1239.8±11.55µs ? ?/sec
physical_plan_clickbench_q40 1.00 2.6±0.02ms ? ?/sec 1.04 2.7±0.01ms ? ?/sec
physical_plan_clickbench_q41 1.00 2.2±0.02ms ? ?/sec 1.07 2.4±0.01ms ? ?/sec
physical_plan_clickbench_q42 1.00 2.2±0.01ms ? ?/sec 1.06 2.3±0.01ms ? ?/sec
physical_plan_clickbench_q43 1.00 2.3±0.01ms ? ?/sec 1.05 2.5±0.01ms ? ?/sec
physical_plan_clickbench_q44 1.00 1191.6±6.80µs ? ?/sec 1.10 1313.2±10.91µs ? ?/sec
physical_plan_clickbench_q45 1.00 1192.1±5.05µs ? ?/sec 1.10 1314.8±11.50µs ? ?/sec
physical_plan_clickbench_q46 1.00 1529.1±5.52µs ? ?/sec 1.07 1635.6±11.43µs ? ?/sec
physical_plan_clickbench_q47 1.00 2.2±0.01ms ? ?/sec 1.05 2.3±0.01ms ? ?/sec
physical_plan_clickbench_q48 1.00 2.3±0.01ms ? ?/sec 1.05 2.4±0.01ms ? ?/sec
physical_plan_clickbench_q49 1.00 2.5±0.01ms ? ?/sec 1.04 2.6±0.01ms ? ?/sec
physical_plan_clickbench_q5 1.00 1208.9±6.12µs ? ?/sec 1.15 1394.7±11.38µs ? ?/sec
physical_plan_clickbench_q50 1.00 2.4±0.01ms ? ?/sec 1.05 2.5±0.01ms ? ?/sec
physical_plan_clickbench_q51 1.00 1625.8±7.38µs ? ?/sec 1.07 1743.5±11.66µs ? ?/sec
physical_plan_clickbench_q6 1.00 1223.1±18.54µs ? ?/sec 1.14 1389.4±11.89µs ? ?/sec
physical_plan_clickbench_q7 1.00 1018.3±11.16µs ? ?/sec 1.17 1187.5±11.45µs ? ?/sec
physical_plan_clickbench_q8 1.00 1480.7±11.10µs ? ?/sec 1.12 1662.9±12.23µs ? ?/sec
physical_plan_clickbench_q9 1.00 1539.1±6.21µs ? ?/sec 1.10 1697.4±12.86µs ? ?/sec
physical_plan_struct_join_agg_sort 1.01 1379.5±3.27µs ? ?/sec 1.00 1372.3±7.80µs ? ?/sec
physical_plan_tpcds_all 1.00 751.7±2.88ms ? ?/sec 1.00 750.0±0.85ms ? ?/sec
physical_plan_tpch_all 1.00 47.9±0.31ms ? ?/sec 1.00 47.8±0.08ms ? ?/sec
physical_plan_tpch_q1 1.00 1536.3±2.83µs ? ?/sec 1.00 1539.3±10.10µs ? ?/sec
physical_plan_tpch_q10 1.01 2.9±0.00ms ? ?/sec 1.00 2.9±0.00ms ? ?/sec
physical_plan_tpch_q11 1.00 2.6±0.01ms ? ?/sec 1.00 2.6±0.00ms ? ?/sec
physical_plan_tpch_q12 1.02 1310.4±2.43µs ? ?/sec 1.00 1284.3±2.31µs ? ?/sec
physical_plan_tpch_q13 1.00 1000.5±2.26µs ? ?/sec 1.00 1000.9±2.46µs ? ?/sec
physical_plan_tpch_q14 1.00 1326.7±3.26µs ? ?/sec 1.00 1327.5±2.76µs ? ?/sec
physical_plan_tpch_q16 1.02 1694.9±6.64µs ? ?/sec 1.00 1665.1±2.59µs ? ?/sec
physical_plan_tpch_q17 1.00 1805.2±2.87µs ? ?/sec 1.01 1823.3±13.88µs ? ?/sec
physical_plan_tpch_q18 1.00 1929.1±4.45µs ? ?/sec 1.00 1932.4±3.01µs ? ?/sec
physical_plan_tpch_q19 1.00 2.5±0.00ms ? ?/sec 1.00 2.5±0.00ms ? ?/sec
physical_plan_tpch_q2 1.00 4.4±0.01ms ? ?/sec 1.00 4.4±0.02ms ? ?/sec
physical_plan_tpch_q20 1.00 2.3±0.00ms ? ?/sec 1.00 2.3±0.00ms ? ?/sec
physical_plan_tpch_q21 1.00 3.0±0.00ms ? ?/sec 1.00 3.0±0.00ms ? ?/sec
physical_plan_tpch_q22 1.00 2.1±0.01ms ? ?/sec 1.00 2.1±0.00ms ? ?/sec
physical_plan_tpch_q3 1.00 1934.3±3.65µs ? ?/sec 1.00 1943.2±2.95µs ? ?/sec
physical_plan_tpch_q4 1.00 1047.2±4.98µs ? ?/sec 1.00 1050.2±2.09µs ? ?/sec
physical_plan_tpch_q5 1.00 2.5±0.00ms ? ?/sec 1.00 2.5±0.00ms ? ?/sec
physical_plan_tpch_q6 1.00 648.5±2.12µs ? ?/sec 1.01 657.8±1.91µs ? ?/sec
physical_plan_tpch_q7 1.01 3.1±0.01ms ? ?/sec 1.00 3.1±0.00ms ? ?/sec
physical_plan_tpch_q8 1.01 4.1±0.01ms ? ?/sec 1.00 4.1±0.01ms ? ?/sec
physical_plan_tpch_q9 1.01 3.0±0.01ms ? ?/sec 1.00 3.0±0.01ms ? ?/sec
physical_select_aggregates_from_200 1.01 14.8±0.09ms ? ?/sec 1.00 14.6±0.03ms ? ?/sec
physical_select_all_from_1000 1.04 18.8±0.10ms ? ?/sec 1.00 18.0±0.07ms ? ?/sec
physical_select_one_from_700 1.01 786.7±2.33µs ? ?/sec 1.00 777.6±6.12µs ? ?/sec
physical_sorted_union_order_by_10_int64 1.01 4.8±0.01ms ? ?/sec 1.00 4.8±0.01ms ? ?/sec
physical_sorted_union_order_by_10_uint64 1.01 11.7±0.05ms ? ?/sec 1.00 11.7±0.05ms ? ?/sec
physical_sorted_union_order_by_50_int64 1.01 118.0±1.06ms ? ?/sec 1.00 116.7±0.50ms ? ?/sec
physical_sorted_union_order_by_50_uint64 1.01 615.8±7.55ms ? ?/sec 1.00 610.5±4.28ms ? ?/sec
physical_theta_join_consider_sort 1.02 1078.3±5.82µs ? ?/sec 1.00 1059.6±3.34µs ? ?/sec
physical_unnest_to_join 1.02 1258.5±12.77µs ? ?/sec 1.00 1228.9±3.12µs ? ?/sec
physical_window_function_partition_by_12_on_values 1.00 750.5±1.81µs ? ?/sec 1.01 756.6±2.89µs ? ?/sec
physical_window_function_partition_by_30_on_values 1.00 1509.9±3.47µs ? ?/sec 1.00 1515.3±7.73µs ? ?/sec
physical_window_function_partition_by_4_on_values 1.00 444.1±5.03µs ? ?/sec 1.02 451.4±1.96µs ? ?/sec
physical_window_function_partition_by_7_on_values 1.00 555.2±5.00µs ? ?/sec 1.01 562.2±2.28µs ? ?/sec
physical_window_function_partition_by_8_on_values 1.00 599.0±1.92µs ? ?/sec 1.01 605.0±1.94µs ? ?/sec
with_param_values_many_columns 1.01 467.6±2.27µs ? ?/sec 1.00 462.7±1.88µs ? ?/sec

Resource Usage

base (merge-base)

MetricValue
Wall time1263.9s
Peak memory18.5 GiB
Avg memory18.4 GiB
CPU user1509.5s
CPU sys1.7s
Disk read0 B
Disk write569.3 MiB

branch

MetricValue
Wall time1241.5s
Peak memory18.5 GiB
Avg memory18.5 GiB
CPU user1487.4s
CPU sys1.3s
Disk read0 B
Disk write23.4 MiB

File an issue against this benchmark runner

@alamb

alamb commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Benchmark results looks good to me -- thanks @AdamGS and @Dandandan

@alamb
alamb enabled auto-merge April 3, 2026 21:07
@alamb
alamb added this pull request to the merge queueApr 3, 2026
Merged via the queue into apache:main with commit 069925dApr 3, 2026
31 checks passed
Rich-T-kid pushed a commit to Rich-T-kid/datafusion that referenced this pull request Apr 21, 2026
## Which issue does this PR close?
Follow up of apache#20768.
## Rationale for this change
`Precision::min/max` allocates a lot of new `ScalarValues`, and it can
be done in place.
While running the `sql_planner` benchmark, it seems like for clickbench
`Statistics::try_merge_iter` is a significant part of the runtime, and
this PR improves that part by about 20-25% locally.
## What changes are included in this PR?
Introduces a couple of of new internal functions to calculate the
min/max of a `Precision` in-place.
## Are these changes tested?
Existing general tests, and a few new unit tests.
## Are there any user-facing changes?
None
---------
Signed-off-by: Adam Gutglick <adamgsal@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commonRelated to common crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@AdamGS@alamb@adriangbot@Dandandan