Parameter · Query Tuning / Planner Method Configuration
enable_parallel_hash
Enables the planner's use of parallel hash plans.
- Default:
on - Type: bool
- Applies: Session (any user)
In plain words
In a parallel hash join, all workers build one hash table together in shared memory. Without it, every worker builds its own complete copy of the hash table, repeating the same work and using memory several times.
For DBAs and operators
With Parallel Hash (PostgreSQL 11+) the inner side is scanned with a Parallel Seq Scan, and workers insert into a shared hash table in dynamic shared memory; batches spill to shared temp files when needed. The memory budget is work_mem × hash_mem_multiplier per participant, so the shared table may use that times the number of processes.
Measured on 18.6, joining two 1,000,000-row tables: Parallel Hash Join with a Parallel Hash inner, cost 34,299. With enable_parallel_hash = off: each worker runs a plain Hash over a full serial Seq Scan of the inner table, cost 54,413, because the build work is repeated in every process.
EXPLAIN ANALYZE of a parallel hash shows Buckets, Batches and memory for the shared table. Turning this off can help if a parallel hash join is spilling heavily or hitting dynamic shared memory limits (could not resize shared memory segment errors in containers with a small /dev/shm are a known support issue).
How to change it
Any user can change it for their session with SET.
See it in context
Related parameters
enable_hashjoin hash_mem_multiplier work_mem max_parallel_workers_per_gather min_dynamic_shared_memory