Skip to content

perf: Optimize DFSchema::qualified_name#21722

Open
neilconway wants to merge 3 commits intoapache:mainfrom
neilconway:neilc/perf-planner-qualified-name
Open

perf: Optimize DFSchema::qualified_name#21722
neilconway wants to merge 3 commits intoapache:mainfrom
neilconway:neilc/perf-planner-qualified-name

Conversation

@neilconway
Copy link
Copy Markdown
Contributor

@neilconway neilconway commented Apr 18, 2026

Which issue does this PR close?

Rationale for this change

DFSchema::qualified_name shows up as a hotspot when profiling the planner. It currently goes through the fmt machinery, which is fairly slow; it is reasonably simple to avoid that and write_str() to a preallocated string.

On the sql_planner benchmark, this yields 1-5% improvements for most benchmarks, with no significant regressions.

What changes are included in this PR?

  • Implement optimization
  • Add unit test to ensure that we preserve compatibility between qualified_name and TableReference::Display

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

@github-actions github-actions bot added the common Related to common crate label Apr 18, 2026
@neilconway neilconway force-pushed the neilc/perf-planner-qualified-name branch from 950ff50 to a426316 Compare April 18, 2026 20:00
@neilconway
Copy link
Copy Markdown
Contributor Author

run benchmark sql_planner

@adriangbot
Copy link
Copy Markdown

🤖 Criterion benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4274464954-1483-wfmlq 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 neilc/perf-planner-qualified-name (ec144c1) to b75df6f (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                                                 main                                   neilc_perf-planner-qualified-name
-----                                                 ----                                   ---------------------------------
logical_aggregate_with_join                           1.06    436.9±1.72µs        ? ?/sec    1.00    412.8±1.28µs        ? ?/sec
logical_plan_struct_join_agg_sort                     1.02    167.2±0.61µs        ? ?/sec    1.00    164.1±0.68µs        ? ?/sec
logical_select_all_from_1000                          1.01      8.4±0.04ms        ? ?/sec    1.00      8.3±0.02ms        ? ?/sec
logical_select_one_from_700                           1.17    321.3±1.51µs        ? ?/sec    1.00    273.9±1.49µs        ? ?/sec
logical_trivial_join_high_numbered_columns            1.06    266.9±0.97µs        ? ?/sec    1.00    251.6±1.19µs        ? ?/sec
logical_trivial_join_low_numbered_columns             1.06    254.6±1.00µs        ? ?/sec    1.00    239.1±1.14µs        ? ?/sec
physical_intersection                                 1.08    602.3±1.75µs        ? ?/sec    1.00    557.4±2.13µs        ? ?/sec
physical_join_consider_sort                           1.02   1030.8±2.77µs        ? ?/sec    1.00   1009.0±3.29µs        ? ?/sec
physical_join_distinct                                1.07    249.1±0.98µs        ? ?/sec    1.00    233.7±1.20µs        ? ?/sec
physical_many_self_joins                              1.00      7.7±0.01ms        ? ?/sec    1.00      7.7±0.03ms        ? ?/sec
physical_plan_clickbench_all                          1.02    129.2±0.39ms        ? ?/sec    1.00    127.1±0.52ms        ? ?/sec
physical_plan_clickbench_q1                           1.00  1377.0±12.46µs        ? ?/sec    1.00  1378.6±33.39µs        ? ?/sec
physical_plan_clickbench_q10                          1.00      2.0±0.01ms        ? ?/sec    1.00      2.0±0.01ms        ? ?/sec
physical_plan_clickbench_q11                          1.01      2.2±0.01ms        ? ?/sec    1.00      2.2±0.01ms        ? ?/sec
physical_plan_clickbench_q12                          1.02      2.3±0.02ms        ? ?/sec    1.00      2.3±0.01ms        ? ?/sec
physical_plan_clickbench_q13                          1.00      2.1±0.01ms        ? ?/sec    1.00      2.1±0.01ms        ? ?/sec
physical_plan_clickbench_q14                          1.01      2.2±0.01ms        ? ?/sec    1.00      2.2±0.01ms        ? ?/sec
physical_plan_clickbench_q15                          1.02      2.1±0.01ms        ? ?/sec    1.00      2.1±0.00ms        ? ?/sec
physical_plan_clickbench_q16                          1.01   1740.4±7.80µs        ? ?/sec    1.00   1715.4±7.34µs        ? ?/sec
physical_plan_clickbench_q17                          1.03   1838.3±9.41µs        ? ?/sec    1.00   1791.5±5.60µs        ? ?/sec
physical_plan_clickbench_q18                          1.00   1628.1±6.18µs        ? ?/sec    1.00   1624.9±5.07µs        ? ?/sec
physical_plan_clickbench_q19                          1.02      2.1±0.01ms        ? ?/sec    1.00      2.0±0.01ms        ? ?/sec
physical_plan_clickbench_q2                           1.00   1776.8±7.45µs        ? ?/sec    1.03  1838.9±52.75µs        ? ?/sec
physical_plan_clickbench_q20                          1.04  1576.8±18.47µs        ? ?/sec    1.00   1515.7±7.31µs        ? ?/sec
physical_plan_clickbench_q21                          1.04   1819.4±5.34µs        ? ?/sec    1.00  1751.0±15.86µs        ? ?/sec
physical_plan_clickbench_q22                          1.06      2.3±0.07ms        ? ?/sec    1.00      2.2±0.00ms        ? ?/sec
physical_plan_clickbench_q23                          1.07      2.6±0.18ms        ? ?/sec    1.00      2.4±0.01ms        ? ?/sec
physical_plan_clickbench_q24                          1.03      5.8±0.10ms        ? ?/sec    1.00      5.7±0.02ms        ? ?/sec
physical_plan_clickbench_q25                          1.02  1930.2±11.08µs        ? ?/sec    1.00  1900.4±14.97µs        ? ?/sec
physical_plan_clickbench_q26                          1.00   1746.8±7.97µs        ? ?/sec    1.00  1738.8±11.10µs        ? ?/sec
physical_plan_clickbench_q27                          1.02   1946.8±7.16µs        ? ?/sec    1.00  1908.4±14.63µs        ? ?/sec
physical_plan_clickbench_q28                          1.05      2.5±0.01ms        ? ?/sec    1.00      2.4±0.01ms        ? ?/sec
physical_plan_clickbench_q29                          1.05      2.7±0.01ms        ? ?/sec    1.00      2.6±0.01ms        ? ?/sec
physical_plan_clickbench_q3                           1.01   1632.4±6.75µs        ? ?/sec    1.00  1620.5±14.72µs        ? ?/sec
physical_plan_clickbench_q30                          1.01     16.5±0.07ms        ? ?/sec    1.00     16.3±0.04ms        ? ?/sec
physical_plan_clickbench_q31                          1.04      2.6±0.01ms        ? ?/sec    1.00      2.5±0.01ms        ? ?/sec
physical_plan_clickbench_q32                          1.04      2.6±0.01ms        ? ?/sec    1.00      2.4±0.01ms        ? ?/sec
physical_plan_clickbench_q33                          1.03      2.0±0.02ms        ? ?/sec    1.00   1981.6±8.47µs        ? ?/sec
physical_plan_clickbench_q34                          1.03   1768.2±7.62µs        ? ?/sec    1.00   1722.4±6.18µs        ? ?/sec
physical_plan_clickbench_q35                          1.03   1830.3±7.07µs        ? ?/sec    1.00   1785.5±6.92µs        ? ?/sec
physical_plan_clickbench_q36                          1.02      2.2±0.01ms        ? ?/sec    1.00      2.1±0.01ms        ? ?/sec
physical_plan_clickbench_q37                          1.02      2.6±0.01ms        ? ?/sec    1.00      2.6±0.01ms        ? ?/sec
physical_plan_clickbench_q38                          1.02      2.6±0.01ms        ? ?/sec    1.00      2.6±0.00ms        ? ?/sec
physical_plan_clickbench_q39                          1.02      2.7±0.01ms        ? ?/sec    1.00      2.7±0.00ms        ? ?/sec
physical_plan_clickbench_q4                           1.01   1433.9±6.17µs        ? ?/sec    1.00   1423.3±7.39µs        ? ?/sec
physical_plan_clickbench_q40                          1.02      3.5±0.01ms        ? ?/sec    1.00      3.4±0.01ms        ? ?/sec
physical_plan_clickbench_q41                          1.01      3.0±0.01ms        ? ?/sec    1.00      2.9±0.00ms        ? ?/sec
physical_plan_clickbench_q42                          1.01      3.2±0.01ms        ? ?/sec    1.00      3.1±0.01ms        ? ?/sec
physical_plan_clickbench_q43                          1.01      3.3±0.01ms        ? ?/sec    1.00      3.2±0.01ms        ? ?/sec
physical_plan_clickbench_q44                          1.03   1542.3±6.42µs        ? ?/sec    1.00   1499.9±6.66µs        ? ?/sec
physical_plan_clickbench_q45                          1.03   1549.6±6.63µs        ? ?/sec    1.00   1500.0±5.78µs        ? ?/sec
physical_plan_clickbench_q46                          1.02   1871.5±7.97µs        ? ?/sec    1.00   1841.2±6.98µs        ? ?/sec
physical_plan_clickbench_q47                          1.02      2.7±0.01ms        ? ?/sec    1.00      2.6±0.02ms        ? ?/sec
physical_plan_clickbench_q48                          1.04      2.9±0.01ms        ? ?/sec    1.00      2.8±0.01ms        ? ?/sec
physical_plan_clickbench_q49                          1.01      3.0±0.02ms        ? ?/sec    1.00      3.0±0.03ms        ? ?/sec
physical_plan_clickbench_q5                           1.00   1573.7±7.15µs        ? ?/sec    1.00   1571.9±7.38µs        ? ?/sec
physical_plan_clickbench_q50                          1.03      2.9±0.01ms        ? ?/sec    1.00      2.9±0.01ms        ? ?/sec
physical_plan_clickbench_q51                          1.03   1999.0±7.11µs        ? ?/sec    1.00  1946.9±10.41µs        ? ?/sec
physical_plan_clickbench_q6                           1.00   1579.5±7.34µs        ? ?/sec    1.00   1575.9±7.02µs        ? ?/sec
physical_plan_clickbench_q7                           1.01   1610.8±5.51µs        ? ?/sec    1.00   1602.0±6.01µs        ? ?/sec
physical_plan_clickbench_q8                           1.01  1940.8±29.36µs        ? ?/sec    1.00   1921.4±7.61µs        ? ?/sec
physical_plan_clickbench_q9                           1.00   1897.2±6.56µs        ? ?/sec    1.00   1897.9±7.08µs        ? ?/sec
physical_plan_struct_join_agg_sort                    1.01   1371.4±2.69µs        ? ?/sec    1.00   1354.7±2.88µs        ? ?/sec
physical_plan_tpcds_all                               1.00    760.3±5.19ms        ? ?/sec    1.00   757.4±19.42ms        ? ?/sec
physical_plan_tpch_all                                1.02     49.6±0.47ms        ? ?/sec    1.00     48.6±0.27ms        ? ?/sec
physical_plan_tpch_q1                                 1.03   1612.4±4.06µs        ? ?/sec    1.00   1570.4±2.42µs        ? ?/sec
physical_plan_tpch_q10                                1.01      3.1±0.00ms        ? ?/sec    1.00      3.1±0.00ms        ? ?/sec
physical_plan_tpch_q11                                1.01      2.6±0.00ms        ? ?/sec    1.00      2.6±0.00ms        ? ?/sec
physical_plan_tpch_q12                                1.00   1328.5±2.79µs        ? ?/sec    1.00   1329.7±2.85µs        ? ?/sec
physical_plan_tpch_q13                                1.00   1000.7±2.56µs        ? ?/sec    1.00   1004.2±2.36µs        ? ?/sec
physical_plan_tpch_q14                                1.00   1458.8±3.47µs        ? ?/sec    1.00   1462.2±3.44µs        ? ?/sec
physical_plan_tpch_q16                                1.02   1670.0±1.89µs        ? ?/sec    1.00   1633.1±6.90µs        ? ?/sec
physical_plan_tpch_q17                                1.04   1860.8±3.60µs        ? ?/sec    1.00   1786.8±3.19µs        ? ?/sec
physical_plan_tpch_q18                                1.05   1956.8±2.81µs        ? ?/sec    1.00   1870.6±2.96µs        ? ?/sec
physical_plan_tpch_q19                                1.02      2.5±0.00ms        ? ?/sec    1.00      2.5±0.01ms        ? ?/sec
physical_plan_tpch_q2                                 1.02      4.4±0.00ms        ? ?/sec    1.00      4.3±0.00ms        ? ?/sec
physical_plan_tpch_q20                                1.03      2.4±0.00ms        ? ?/sec    1.00      2.4±0.00ms        ? ?/sec
physical_plan_tpch_q21                                1.01      3.2±0.00ms        ? ?/sec    1.00      3.1±0.00ms        ? ?/sec
physical_plan_tpch_q22                                1.02      2.1±0.00ms        ? ?/sec    1.00      2.0±0.00ms        ? ?/sec
physical_plan_tpch_q3                                 1.02      2.1±0.00ms        ? ?/sec    1.00      2.0±0.00ms        ? ?/sec
physical_plan_tpch_q4                                 1.01   1168.1±2.31µs        ? ?/sec    1.00   1157.4±3.16µs        ? ?/sec
physical_plan_tpch_q5                                 1.00      2.7±0.00ms        ? ?/sec    1.00      2.7±0.00ms        ? ?/sec
physical_plan_tpch_q6                                 1.01    677.3±3.84µs        ? ?/sec    1.00    673.3±1.79µs        ? ?/sec
physical_plan_tpch_q7                                 1.00      3.2±0.00ms        ? ?/sec    1.00      3.3±0.00ms        ? ?/sec
physical_plan_tpch_q8                                 1.01      4.3±0.01ms        ? ?/sec    1.00      4.2±0.00ms        ? ?/sec
physical_plan_tpch_q9                                 1.01      3.0±0.00ms        ? ?/sec    1.00      3.0±0.00ms        ? ?/sec
physical_select_aggregates_from_200                   1.00     14.5±0.03ms        ? ?/sec    1.00     14.6±0.02ms        ? ?/sec
physical_select_all_from_1000                         1.01     18.2±0.09ms        ? ?/sec    1.00     18.0±0.05ms        ? ?/sec
physical_select_one_from_700                          1.11    794.4±1.60µs        ? ?/sec    1.00    718.8±1.70µ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.02     11.8±0.07ms        ? ?/sec    1.00     11.7±0.06ms        ? ?/sec
physical_sorted_union_order_by_50_int64               1.02    116.6±0.77ms        ? ?/sec    1.00    114.3±0.37ms        ? ?/sec
physical_sorted_union_order_by_50_uint64              1.02    610.9±3.80ms        ? ?/sec    1.00    597.2±1.36ms        ? ?/sec
physical_theta_join_consider_sort                     1.05   1077.1±5.98µs        ? ?/sec    1.00   1029.3±2.33µs        ? ?/sec
physical_unnest_to_join                               1.04   1234.3±1.84µs        ? ?/sec    1.00   1183.3±3.53µs        ? ?/sec
physical_window_function_partition_by_12_on_values    1.00    748.7±1.22µs        ? ?/sec    1.01    753.1±1.59µs        ? ?/sec
physical_window_function_partition_by_30_on_values    1.00   1510.5±3.05µs        ? ?/sec    1.00   1509.1±2.72µs        ? ?/sec
physical_window_function_partition_by_4_on_values     1.02    451.5±1.01µs        ? ?/sec    1.00    440.7±1.08µs        ? ?/sec
physical_window_function_partition_by_7_on_values     1.00    560.6±1.95µs        ? ?/sec    1.00    562.7±1.16µs        ? ?/sec
physical_window_function_partition_by_8_on_values     1.00    602.0±1.39µs        ? ?/sec    1.00    604.5±1.16µs        ? ?/sec
with_param_values_many_columns                        1.00    463.1±2.16µs        ? ?/sec    1.01    465.6±2.44µs        ? ?/sec

Resource Usage

base (merge-base)

Metric Value
Wall time 1242.6s
Peak memory 18.5 GiB
Avg memory 18.5 GiB
CPU user 1486.0s
CPU sys 1.7s
Peak spill 0 B

branch

Metric Value
Wall time 1239.3s
Peak memory 18.5 GiB
Avg memory 18.5 GiB
CPU user 1483.9s
CPU sys 1.1s
Peak spill 0 B

File an issue against this benchmark runner

@neilconway neilconway marked this pull request as ready for review April 18, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to common crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize DFSchema::qualified_name

2 participants