Our order database runs on Postgres 15 on a virtual machine with sixty four gigabytes of memory, sixteen of them for shared_buffers. Last spring the finance team complained that their Monday reports were slow, and we raised work_mem from sixteen megabytes to five hundred and twelve for everyone, which made them fast.
On the first Monday of September, at five past nine, every application connected to that database lost its connections at once. Checkout returned errors for about forty seconds and then recovered by itself. The Postgres log said a server process had been terminated by signal 9, Killed, and that it was terminating any other active server processes. The kernel log named the process the OOM killer had chosen: a Postgres backend with forty one gigabytes resident. It happened again in October.
work_mem is not a limit per query.…