Skip to content

Implement Radix Hash Join #18939

Open

Description

@Dandandan

Is your feature request related to a problem or challenge?

Hash Joins with large build side & lots of hash-duplicates are relatively slow in DataFusion.

The cost seems largely associated with traversing the chain of duplicates (chain_traverse) (1) + which is known to be very cache-inefficient, as the access pattern is mostly random.

Currently, we implement hash joins partitioned by hash, but we can implement a more efficient algorithm (radix hash join) that splits build data into smaller tables that individually mostly fits in CPU caches and allow more efficient access patterns.

[TODO: collect some issues / examples]

(1) #17494

Describe the solution you'd like

Implement a version of Radix Hash Joins:

Image

https://15721.courses.cs.cmu.edu/spring2016/papers/balkesen-icde2013.pdf

Describe alternatives you've considered

No response

Additional context

No response

Activity

  1. Omega359 commented on Nov 26, 2025

    @Omega359
    Contributor

    This paper is well worth a read here https://db.in.tum.de/~bandle/papers/bandle-partitionVsNonPartition.pdf

    "So unless the radix join is beneficial for other
    reasons, e.g., larger than main-memory working sets, we express
    reservations that implementing the radix join in a general-purpose
    production system justifies the added complexity."

  2. Dandandan commented on Nov 26, 2025

    @Dandandan
    ContributorAuthor

    Thank you!

  3. Omega359 commented on Nov 26, 2025

    @Omega359
    Contributor

    For anyone curious how radix joins work I present to you Andy Pavlo (who else): https://youtu.be/pqRV7Mss1Fg?si=WPlilqTfHIC-7UMf&t=1813

  4. Dandandan commented on Nov 27, 2025

    @Dandandan
    ContributorAuthor

    Another data point is that DuckDB and other engines implement radix hash join and seem to have good results doing so, maybe there are newer resources showing this improvement better?

    TPC-H joins are relatively easy: most joins are on some integer key column without many duplicate values when the build side is the "correct" one. The results from this paper are from TPC-H only (on which we perform already reasonably good for most queries).

  5. Omega359 commented on Nov 28, 2025

    @Omega359
    Contributor

    It's quite possible that newer research has better info, or points to where RHJ would be significantly better than the existing HJ or SMJ! I just wanted to bring your attention to the research that I've read on the subject.

  6. alamb commented on Dec 1, 2025

    @alamb
    Contributor

    @XiangpengHao has some thoughts on this topic I think

    Also, see https://crates.io/crates/congee for an implementation of a radix tree in high performance rust

  7. saadtajwar commented on Jun 30, 2026

    @saadtajwar
    Contributor

    Hey @Dandandan, happy to help out with this if it's still open! TY!

  8. alamb commented on Jul 1, 2026

    @alamb
    Contributor

    This is one of those projects where we would probably need to do a prototype and get that working well / with high performance, before spending a lot of time polishing / preparing to swtich the main implementation in DataFusion

  9. saadtajwar commented on Jul 1, 2026

    @saadtajwar
    Contributor

    Hmm I see, thanks @alamb - I'll hold off on this for now :)

  10. duongcongtoai commented on Jul 16, 2026

    @duongcongtoai
    Contributor

    Another data point is that DuckDB and other engines implement radix hash join

    I did some personal research myself, i think they are not implementing radix hash join (even though in source code they do refer things like RadixPartition). They are implementing HHJ: https://duckdb.org/library/saving-private-hash-join-vldb/

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestperformanceMake DataFusion faster

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions