Plan nodes · Joins
Hash
Builds the hash table for its parent Hash Join.
Reads its child completely into an in-memory hash table: the build side of a Hash Join. Its figures show the buckets, the batches and the memory used.
Example
SELECT a.name, count(*) FROM artists a JOIN albums b ON b.artist_id = a.id GROUP BY a.name
6 nodes
Aggregaterows 2,000 (estimated 2,000) cost 521.26..541.26 buffers: 141 hit
strategy Hashed
group by a.name
201 kB memory
Hash Joinrows 2,000 (estimated 2,000) cost 486..511.26 buffers: 141 hit
hash on (b.artist_id = a.id)
Aggregaterows 2,000 (estimated 2,000) cost 428..448 buffers: 128 hit
strategy Hashed
group by b.artist_id
201 kB memory
Seq Scan on albums brows 20,000 (estimated 20,000) cost 0..328 buffers: 128 hit
Hashrows 2,000 (estimated 2,000) cost 33..33 buffers: 13 hit
2,048 hash buckets · 1 batches · 87 kB memory
Seq Scan on artists arows 2,000 (estimated 2,000) cost 0..33 buffers: 13 hit
Run with EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) on the sample database, PostgreSQL 19.0. Open it in the EXPLAIN visualizer →
Related
Nested Loop · Hash Join · Merge Join · Memoize · Materialize