MemoryAny session (SET)default 2
hash_mem_multiplier
Multiple of "work_mem" to use for hash tables.
How you change it
Any session (SET)
Defaults and ranges on this page were read from pg_settings on live PostgreSQL 18.4. Treat older majors as needing their own check before you copy a value.
What this means
Multiplies work_mem specifically for hash-based nodes (hash joins and hash aggregation). It lets you give memory-hungry hash operations more headroom without raising work_mem for every sort and node in every query. The effective limit for a hash node is work_mem times this multiplier.
When it matters
Raise it when hash joins or GROUP BY spill to disk (visible as 'Batches: N' in EXPLAIN ANALYZE) but a global work_mem increase would be too risky.
| Default | 2 |
|---|---|
| Range | 1 – 1000 |
| Type | real |
| Change scope | Any session (SET) |
| Category | Memory |
Check the current value
SHOW hash_mem_multiplier;Tradeoffs
- • Too low: large hash joins spill into multiple batches and slow down.
- • Because it only affects hash nodes, it is a safer lever than work_mem for analytic queries.
- • Still multiplies per hash node, so heavy concurrency can add up.