Join

Hash Join

Join algorithm that builds an in-memory hash table from one input and probes it with rows from the other.

A Hash Join reads one input completely (the build side), hashes its join keys into an in-memory table, and then streams the other input (the probe side) past the hash table to find matches.

It is the planner's go-to algorithm when both sides are large but the build side fits in work_mem. If it does not fit, PostgreSQL falls back to a multi-batch hash join that spills to disk.

Hash Joins do not require sorted inputs and can outperform Nested Loops dramatically on bulk analytics queries. The most common tuning lever is work_mem — too small and the join spills; too large and concurrent queries can exhaust memory.