work_mem

PostgreSQL

Per-operation memory limit for internal sort operations, hash tables, and bitmap heap scans. Set per session/query. Too low causes disk spills to temporary files; too high risks memory exhaustion under concurrency.