↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / Plan Nodes

Hash

Builds the hash table consumed by a hash join.

Reading PG 18·Select a recorded version

Core node tag
T_Hash
Structured EXPLAIN Node Type
Hash
Inputs
The hash join inner child plan
Output
Hash table, not a normal tuple stream
Executor initializer
ExecInitHash
Memory mechanism
hash-batches
evidence kind
source and documentation
explain names
Hash
explain prefixes
Parallel, Async
node tag
T_Hash
parallel callbacks
ExecHashEstimate, ExecHashInitializeDSM, ExecHashInitializeWorker, ExecHashRetrieveInstrumentation
partial modes
Unknown
runtime verified
false
strategies
Unknown

Definition PG 18

Builds the hash table consumed by a hash join.

EXPLAIN labels in this source build

Text-format labelStructured node identity
HashHash

Compare versions

Complete source facts

memory

{"description":"Hash-join execution can partition work into batches backed by temporary files. This describes hash-join batching, not the spill policy of aggregate or Memoize nodes.","evidence":[{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/nodeHash.c","path":"src/backend/executor/nodeHash.c","sha256":"f83e9b10129450f2dc52ac7ea5147b7c51c12648ae1b3b3195bb3f0b4895fafc","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/nodeHashjoin.c","path":"src/backend/executor/nodeHashjoin.c","sha256":"4a72b0db253c1905c415462cfe56a2327ac65507c607b6d699d2717fa624ad56","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"}],"mechanism":"hash-batches","source_notes":["It's time to begin hashing, or if we just arrived here then hashing is already underway, so join in that effort. While hashing we have to be prepared to help increase the number of batches or buckets at any time, and if we arrived here when that was already underway we'll have to help complete that work immediately so that it's safe to access batches and buckets below.","Make sure that any tuples we wrote to disk are visible to others before anyone tries to load them.","Elect one backend to disable any further growth. Batches are now fixed. While building them we made sure they'd fit in our memory budget when we load them back in later (or we tried to do that and gave up because we detected extreme skew).","Parallel Hash tries to use the combined hash_mem of all workers to avoid the need to batch. If that won't work, it falls back to hash_mem per worker and tries to process batches in parallel."]}

source inventory

{"executor":"src/backend/executor/execProcnode.c","explain":"src/backend/commands/explain.c","implementation":"src/backend/executor/nodeHash.c"}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · 555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f

Text language: en · 555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f