GitHub - rusanoph/unchained-hash-join-research: Contiguous hash join research in DuckDB and Apache DataFusion: engine integrations, SQL benchmarks, memory locality, and break-even analysis.

GitHub

4 min read Original article ↗

Paper DOI Dataset DOI Verify research artifacts DuckDB Library

When does the cost of building contiguous ranges pay off in a hash join? This study integrates the layout into DuckDB 1.5.6 and Apache DataFusion 55.2.0 and measures both against their native execution paths on one thread.

DataFusion SNAP: 73% less total query time. DuckDB JOB: 0.948× stock-to-policy time ratio. These are within-engine comparisons on different workloads. The break-even model links the difference to the cost of moving build rows, the keys reached by probes, and the layout of the payload.

Paper (PDF) · Reproduce an Enron join · DuckDB implementation · DataFusion implementation · Cite this work · Release v1.0.0

Linked duplicates versus contiguous ranges of matching keys

Build DuckDB · Build DataFusion · Rebuild the paper · Original Unchained paper

Compared with the native join

Engine and comparison Workload Result
DuckDB stock vs contiguous-row policy 35 SNAP graph queries 1.068× [1.059, 1.077]
DuckDB stock vs contiguous-row policy 113 JOB queries 0.948× [0.945, 0.951]
DataFusion native vs auto at 200K build rows 35 SNAP graph queries 73% less total time with auto
DataFusion native vs auto at 200K build rows 100 JOB queries 11.7% less total time with auto

DuckDB reports geometric means of per-query stock-to-policy time ratios with 95% confidence intervals. DataFusion compares sums of per-query median times. Both DataFusion modes use the same build of the engine. Native mode uses the engine's own join index, and auto can select CSR. Auto selected CSR in 24 of 35 SNAP queries and 56 of 100 JOB queries. On DuckDB JOB 22d, the experimental join scattered 5.54 million build rows for three probe rows. DuckDB measurements · DataFusion measurements

Upstream collaboration

The DataFusion PR #27746 follow-up measures contiguous match storage on SNAP and JOB and independently evaluates the dense counting-sort patch on x86-64. The study includes raw evidence and a dataset-free verifier. Upstream validation.

DataFusion follow-up on the auto threshold

Lowering the threshold from 200K to 50K yielded a 2.177× speed ratio [2.156, 2.212] on 12 held-out Enron and HepPh graph queries and 1.004× [0.977, 1.016] on 31 analytical queries whose index selection changed. These ratios are medians of paired block ratios of summed query times, with 95% confidence intervals. The 50K setting is supported for the tested graph workload. Threshold measurements

Implementations and evidence

  • DuckDB contains the C++ core, the v17 engine patch, and a SQL worker. The smoke test checks result rows against SQLite and confirms the experimental path and native fallback. Measurements and per-query evidence · DuckDB Library listing · Research discussion
  • DataFusion contains the Rust CSR core, the v10b engine patch, and a SQL worker. The smoke test checks both CSR layouts and the small-build fallback. The Enron example runs one holdout query at both thresholds and checks the exact result and the index each run actually built. Measurements and Enron example
  • Article traces both layouts from construction through SQL execution and derives a break-even condition for probe savings. Its measured figures can be regenerated from the bundled engine evidence.

The benchmark tables summarize recorded campaigns. The build and smoke commands verify the supplied code on small fixtures. The v1.0.0 release includes an archive of 24,282 per-observation measurements with a Python script that recomputes the main results. Download the measurement archive · Cite the dataset on Zenodo

CI tests both standalone cores, verifies the v1.0.0 measurement archive by SHA-256, and recomputes its published statistics. It also rebuilds the figures and paper from the bundled summaries.

Licenses

The original research code, including the implementations and the build and analysis scripts, is available under the MIT License. The patches retain the DuckDB license and the Apache DataFusion license and notice, respectively.

The article, its original figures and the original benchmark observations are available under CC BY 4.0. When reusing them, credit Maxim Rusanov, link to the relevant DOI and license, and indicate any changes. Article DOI · Dataset DOI