hash_mem_multiplier
No restart — settable per sessionmultiplier (× work_mem)
Gives hash-based operations more memory than plain work_mem.
What it does
Hash joins and hash aggregates get a memory budget of work_mem × hash_mem_multiplier (default 2.0 in modern versions), letting them stay in memory at sizes where a sort would spill. It lets you favor hashes without inflating the base work_mem that every sort also uses.
How to tune it
If you see hash joins or hash aggregates spilling (Batches > 1, temp files) while sorts are fine, raise hash_mem_multiplier rather than work_mem — that targets the extra memory at hashes only. 2–4 is a common range.
What the analyzer flags
- Hash build spilled across N batches
- HashAggregate touched temp files