pg-primary has 64 GB of RAM and is running shared_buffers = 128MB, because that is what the package shipped and the install left behind. Two application servers open 400 connections against a max_connections of 200. And Nadia knows which pages users complain about, not which statements are slow. Six topics fix all three.
6 topics
The last five chapters explained the machine: how a row is physically stored, why a version of it survives the update that replaced it, what vacuum is cleaning up, how an index finds a tuple, and how the planner prices one access path against another. That knowledge ends at the edge of a single query. It says nothing about a server whose memory settings were chosen for a laptop, nothing about four hundred processes competing for sixteen cores, and nothing about which of ten thousand statements a day is worth reading a plan for in the first place.
This chapter opens the operations half of the book, and it starts where every real Postgres installation starts: with defaults that were chosen so the server would start anywhere, on hardware that deserves better. The three settings that matter most are all memory. The single largest architectural change is a pooler. And the two extensions that turn a support ticket into a query id cost a restart and a few percent of a core.
By the end, Cartwheel has memory sized to its hardware, pgbouncer-01 in transaction mode turning 400 client connections into 40 server ones, a ranked list of the statements consuming the primary's time, a dozen counters on a dashboard, a benchmark that moves one setting per run and writes the number down, and a configuration file where every non-default line has a sentence explaining itself. What it still does not have is a way to make delivery_events manageable, which is where Chapter 11 begins.
What this chapter changes on pg-primary, in the order it changes it
Packaged defaultschosen so the server starts anywhere
→
Memory sized to the hardwareshared_buffers · work_mem · the OS cache
→
400 clients → 40 server connectionsthroughput up on hardware that did not change
→
Statements ranked, plans captureda restart and a few percent of a core
→
A dashboard and a justified configno number quoted out of context