When a client migrated their video metadata workload to PostgreSQL 16, the default config burned 40% of available RAM on the wrong thing. Here's what we changed.
shared_buffers
The default 128MB is laughably wrong for a 128GB box. Set it to 25% of system RAM as a starting point.
work_mem
Per-operation memory. Multiply by max_connections × average concurrent ops to estimate worst case.
WAL compression
Turn it on. CPU cost is negligible; disk and replication bandwidth savings are dramatic.
The result
P99 query latency dropped from 240ms to 38ms. Disk throughput halved.