work_mem is a GUC parameter specifying the maximum amount of memory available for internal sort operations and hash tables, beyond which the operations will spill to disk (and risk becoming considerably slower).
Default value for
- PostgreSQL 9.4 and later:
- PostgreSQL 9.3 and earlier:
work_mem require a reload to take effect and are effective immediately for all backends.