Sweaty Imposter

synchronous_commit = on (fsync Before Ack) Versus synchronous_commit = off (Ack Before fsync)

TradeoffDatabase InternalsMidSeniorUpdated

Postgres synchronous_commit: leave it ON (fsync WAL before ack) or set it OFF (ack early, fsync later) to chase throughput.

Short answer: synchronous_commit = on (fsync before ack). Default ON is the only setting that guarantees a committed transaction survives a crash.

The Two Options

A

synchronous_commit = on (fsync before ack)

B

synchronous_commit = off (ack before fsync)

Drill This: Your Pick First

The Better Pick

Option A

synchronous_commit = on (fsync before ack)

Default ON is the only setting that guarantees a committed transaction survives a crash. The right way to claw back throughput is batching (group commit), faster storage, or SSDs with battery-backed cache, not silently losing the last N transactions.

When the Other One Wins

synchronous_commit = off (ack before fsync)

Workloads where the last few seconds of writes are truly disposable (telemetry, analytics ingest with replay) can flip it off for big throughput gains. Be explicit about the data-loss window.