Repository navigation
Description
Parent Issue
Detail of Subtask
Evidence reassessment — 2026-10-27
Current delivery/performance status: The scalar probe-geometry candidate improved kernel controls and Q21 but independently regressed Q15 by about 3% in both full-suite and longer targeted runs. It fails the no-regression gate, so no PR was opened. The issue is being closed as not planned, without claiming that future optimizations are impossible. Measurements and decision.
Observed: Historical SF100 FindBatch exclusive user shares are about 34.16%/32.89%/38.77% in Q3/Q4/Q5, 18.40% in Q9 and 20.20% in Q21. Runtime filters, input counts, match rates and layouts differ between engines.
Not yet established: Cost per comparable lookup after normalizing actual probe work, canonical key preparation, load factor, collision chains and locality on current main.
Next discriminating experiment: Use actual caller sizes and matched hit/miss, duplicate, key-width and table-occupancy distributions. Separate hash/key generation from probing and report instructions/CPU per equivalent operation alongside total operator work.
Measured target: Unchanged Q3-Q5/Q9/Q21 plus equal-work lookup benchmarks, with attributable cost-per-probe and query improvement.
Mandatory controls and total cost boundary: Misses, skew, collisions, growth, high/low occupancy, nullable/composite keys, tiny/empty calls and admission failure. Include setup, metadata and unsupported paths.
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
- Provide matched-work CPU/instruction benchmarks with hit/miss, collision, duplicate, load-factor, skew and key-width controls.
- Focused tests cover collisions, NULL/key encoding, growth/admission failure and reset/reuse; query operators retain their existing cancellation and ownership contracts.
- Profiles demonstrate reduced cost per equivalent probe/key-preparation operation, followed by unchanged Q3–Q5/Q9/Q21 query measurements.
- Report effects independently from runtime-filter or join-order reductions and from high-cardinality aggregate update changes.
Describe implementation you've considered
Evaluate existing layout/batched probing, bounded prefetch or reuse of canonical work only after identifying the dominant cost. Do not add per-probe proof/prefetch/index work that loses on hits, tiny calls or cache-resident tables.
Coordination: Keep reductions in probe count under #30844 distinct from kernel gains. Reuse #27753 canonical transport rather than duplicating it.
Additional information
- Reassessed profile/caller evidence and delivery ledger.
- Historical MO source
873282742714436bff407dfcdbbe879147162bd3; DuckDB069cc9f9b5be802405797faecc284961b07c70ef. SF10 all-query profiles; SF100 results/profiles; mixed-I/O evidence. These are pinned historical captures, not current-main scores. - New local component experiments are recorded above; they are rejection evidence, not accepted TPC-H query results. Foreground query work, engine background maintenance, kernel CPU and off-CPU waits must be distinguished; all remain inside whole-application resource accounting.
Pinned implementation / plan references
Activity
aunjgr commentedon Oct 27, 2026
Local-only four-lane first-slot lookup experiment: rejected; no PR. The optimization issue remains open.
The private candidate (
2372b88e4b) loads four first cells independently, resolves common hit/empty lanes inline, and calls a collision-tail helper only when needed. Hash generation, zero-marker behavior, insertion/growth/admission, table encoding and prehashed lookup are unchanged. Comparison base:2465dae7a4ada1b277113cca5afff6fe10149b96; the subsequently fetched main change is Python SDK only, so it does not change this engine/test closure. No optimizer, SUM or #31034 changes are included.Matched normal Go1.27.1, GOAMD64=v3 / GOEXPERIMENT=simd, identical fixtures and observable output stores on both sides. CPU0/GOMAXPROCS1; six balanced compiler-free process pairs; the first result in each process is discarded. No input/result verification in benchmark scripts.
The 36-case matrix loses across tested cache-resident hit/miss/duplicate/collision shapes. Its nominal table sizes are32,16384 and1048576 entries; the repeat-probe fixture is cache-resident and is not evidence of random DRAM lookup performance. Removing an out-of-line common-lane resolver reduced the initial loss but did not pass acceptance.
Independent longer confirmation (1 second per selected case, six balanced pairs):
No allocation change. Hashtable/hashmap/hashjoin correctness suites pass. The confirmed cache-resident/control losses block publication; a hypothetical large/random-table gain cannot waive them. No target-query/TPC-H acceptance or SF100 result is claimed, and no benchmark MO service is held.
A separate bounded local SF10 diagnostic pass sampled actual lookup and aggregate call shapes, without instrumenting either candidate or scoring diagnostic timing. Its combined-query reservoir does not establish per-query weighted work or intrinsic MO-versus-DuckDB table cost. The next design still needs matched real-work profiling and a cheaper common path before another prefetch/lane mechanism is proposed. Performance verification for this task is local only.
Follow-up local diagnosis, warm runs: In the original binary, Go already inlines both
findCellandcellAtintoFindBatch. The four-lane variant growsFindBatchfrom 414 to 1,977 bytes and its stack frame from 24 to 168 bytes; disassembly shows the four hashes, positions and intermediate values being spilled and reloaded. The hit fixture repeats 32 keys in a 1,024-cell table, so it exercises hot, collision-free first slots with precomputed hashes.For a separate warm 256-row profile, instructions per operation fell about 8%, but cycles rose about 5–6%. A further matched counter profile recorded about 263 versus 1,414 dispatched stores per batch and about 45% more backend-stalled dispatch slots; L1 data-cache read misses stayed negligible. That is consistent with the generated stack traffic overwhelming the instruction savings on this hot workload. The one-row case takes the scalar tail but still pays the enlarged function's setup: its profile showed about 13% more instructions and 18% more cycles.
These counters and roughly 2,000 CPU samples per binary are diagnostics on the frozen Go 1.27.1 builds. They are separate from the six-pair latency confirmation and do not establish performance for a cold/random table or unchanged TPC-H queries.
aunjgr commentedon Oct 27, 2026
Local current-main experiment for this issue:
Int64HashMap.FindBatchcandidatecfc4fbaa23binds the stable block geometry once per batch while retaining the sequential probe, collision, wrap and output order. Baseline is1231f06468. This is independent of the SUM candidate and does not change the query plan.In the matched owner matrix, 31 of 36 cases showed faster signals, none showed a slower signal, and allocations were unchanged. A separate warm 256-row profile on a 16,384-entry table measured about 22% fewer cycles and 25% fewer instructions per batch. The earlier four-lane implementation remains rejected.
Twelve clean SF10 process pairs with three warm calls per query produced the following target-query results. The first call to each query in each process was excluded; paired change is the median per-pair ratio, so it need not equal the ratio of the two displayed marginal medians.
All five intervals cross zero. A separate, preregistered Q21 confirmation used six independent balanced pairs and nine warm calls per arm: main 1.367 s, candidate 1.350 s, -0.97% paired, 95% interval -2.36% to -0.53%. Separate Q9/Q21 CPU profiles showed respectively 2.8% and 3.2% fewer whole-application instructions; these are single profile pairs, not latency scores.
All 36 retained target and Q21-confirmation arms used eight physical cores, a 16 GiB CN cache and a 32 GiB application cap; every arm had zero measured physical I/O, spill and application swap. Maximum conservative application footprint was 19.15 GiB. Overlapped or interrupted whole pairs were excluded and rerun. The query worker executes and drains results without input, schema, row, reference, result or checksum verification. SF100 was not measured locally.
The full local Q1–Q22 regression check is running. No PR or issue-closure decision is claimed until it and the required review/static gates finish.
Full-query timing update: Six clean local SF10 Q1–Q22 pairs have now completed. Q15 is the only query with a slower interval: main median 0.399 s, candidate median 0.415 s, paired change +2.99% (95% interval +2.55% to +4.10%). Q2, Q9, Q13 and Q21 showed faster signals; these gains cannot offset a confirmed Q15 regression. The 12 retained full-suite arms all passed the host and all-memory resource checks; peak conservative application memory was 23.69 GiB and measured physical I/O, spill and application swap were zero. CPU profiles and independent longer Q4/Q15 confirmations are still running. No PR acceptance is claimed while the Q15 signal is unresolved.
aunjgr commentedon Oct 27, 2026
Closing as not planned because the measured candidate fails the required no-regression gate. This does not prove that all future probe optimizations are impossible; a different implementation can reopen the issue with full-query evidence.
The scalar geometry-hoisting candidate
cfc4fbaa23is a real component optimization: 31/36 matched owner cases showed faster signals, none showed a slower signal, and a separate 256-row profile measured about 22% fewer cycles and 25% fewer instructions. An independent Q21 check also showed a 0.97% paired latency improvement (95% interval 0.53–2.36% faster).However, Q15 regressed in the full local SF10 Q1–Q22 comparison and in an independent longer confirmation:
The paired change is the median of individual pair ratios; it need not equal the ratio of the two marginal medians. Q15 was slower in all six pairs of each experiment. The independent Q4 interval crossed zero. Q2, Q9, Q13 and Q21 showed faster signals in the full suite, but those gains do not offset the confirmed Q15 regression.
Separate Q15 profiles did not isolate a definitive cause. In these single profile arms, total user cycles were nearly unchanged and instructions fell 2.7%;
TableScan.evalFilteraccounted for 11.9% versus 14.2% of samples. Its normalized generated instruction sequence is identical, but its entry moved by 32 bytes between the two binaries. This is consistent with an indirect code-layout effect, not proof of one. The full recordings and per-query timing/resource evidence will be linked separately for further analysis.All retained full-suite and confirmation arms used eight physical CPUs, a 16 GiB CN cache and a 32 GiB whole-application cap. They recorded zero physical I/O, spill and application swap; peak conservative application memory was 23.69 GiB. Interrupted or overlapping whole pairs were excluded and rerun. First query calls were excluded as warmups. The worker executed and drained queries without input, schema, row, reference, result or checksum verification. SF100 was not measured locally. Owning hashtable/hashmap/hashjoin tests, focused race tests and scoped static checks passed. No production PR was opened.
aunjgr commentedon Oct 27, 2026
Full local SF10 timing table
Six balanced process pairs, three measured warm calls per query per arm after the excluded cold warmup. Clean main
1231f06468, candidatecfc4fbaa23. The worker executed and drained results without input/schema/row/reference/result validation, serialization or result checksums. All 12 retained arms passed the host and all-memory resource gates.The paired change is the median of individual pair ratios; it need not equal the ratio of the two marginal medians. Q15 was independently confirmed slower in six additional pairs with nine warm calls per query: +3.03% (95% interval +0.72% to +7.59%). Q4’s independent interval crossed zero. No faster query cancels the Q15 regression.
Separate warm CPU recordings were collected for Q3, Q4, Q5, Q9, Q15 and Q21 for each version. A public upload of the raw recordings and supporting files was rejected by automatic approval review and is pending explicit authorization; the profiles remain available locally.