WAL & replicationintermediatePro runbook

Right-size synchronous_commit for latency

A real PG16 top-level DO lab committed 300 single-row transactions in each mode. synchronous_commit=off was much faster on local storage, but recently acknowledged transactions can be lost after a crash.

Problem

What you're actually looking at

The symptom as it shows up on a real server.

Every COMMIT with synchronous_commit on waits for WAL to reach durable storage. For a transaction that did real work the wait is amortized into nothing. For a stream of tiny transactions it is most of the cost, and the shape of the fix, batch the work, or relax durability for that specific job, depends on knowing how big the gap actually is on your hardware.

An acknowledgement feed performs 300 real commits with synchronous_commit on and 300 with it off, using top-level transaction control in psql.

Simple terms

With synchronous_commit on, every COMMIT waits for the WAL to be physically flushed to durable storage before it returns. For a transaction that did real work, that wait disappears into the noise. For a flood of tiny one-row transactions, that flush is almost the entire cost. Turning it off makes those commits dramatically faster, but the trade is real: after a crash you can lose the most recently committed transactions, so it is a per-job decision, not a global switch.

ProCaptured evidence where the run produced it

Full runbook for this incident

The scenario above is free. What Pro unlocks is the fix: how to identify right-size synchronous_commit for latency, the exact SQL to trace it, PostgreSQL 18 output for the steps we captured, the resolution path, and how to stop it recurring.
  • The full identify checklist, the exact signals that tell you it's this incident
  • Every diagnostic query; lab output is attached only to the steps we actually captured
  • The resolution path and the pitfalls that make it worse
  • Mitigation steps to stop it recurring, plus a verify-you're-done query

Card required. Cancel before day 7 and you are not charged.

Compare plans

Connected

How this connects to the rest of the library

A live view of this page's real cross-references, what explains it, what fixes it, what to tune, and where to go next. Every link is an authored relationship, not a guess.

Open in the interactive map →
ShareLinkedInX

Need the full procedure?

Pro runbooks finish the incident path

Free runbooks teach the shape. Pro opens the full step transcript, edge cases, and prevention depth.

FollowSubstackLinkedInnew errors · lab notes · hiring loops