synchronous_commit
Whether COMMIT waits for its WAL to reach disk (and standbys) before reporting success.
- Standard
on- Range
- on, off, local, remote_write, remote_apply
- Restart needed
- Nein
- Default checked on
- PostgreSQL 18
Was es bewirkt
on waits for the local WAL flush and, with synchronous standbys, their flush. off returns before the flush: a crash can lose the last few hundred milliseconds of commits (up to three times wal_writer_delay) but never corrupts data. local, remote_write and remote_apply choose how far a synchronous standby must get.
Standardwert
on. on (PostgreSQL 18).
Check the current value
SHOW synchronous_commit; SELECT setting, unit, boot_val, context, source, pending_restart FROM pg_settings WHERE name = 'synchronous_commit';
Change it
SET synchronous_commit = off; -- this session ALTER ROLE reporting SET synchronous_commit = off; -- new sessions of one role ALTER SYSTEM SET synchronous_commit = off; SELECT pg_reload_conf();
No restart. Any role can SET it for a session or with SET LOCAL for one transaction; a server-wide ALTER SYSTEM change applies after a reload (context is user).
When to change it
Turn it off per transaction (SET LOCAL synchronous_commit = off) for data you can afford to lose, such as logs or metrics, to cut commit latency without risking the rest.
What can go wrong
off loses acknowledged commits on a crash. Unlike fsync = off, it cannot corrupt the database.
The closest setting on other engines
| Engine | Einstellung | Standard | Restart |
|---|---|---|---|
| PostgreSQL |
synchronous_commit this page
|
on |
Nein |
| MySQL |
innodb_flush_log_at_trx_commit
|
1 |
Nein |
| SQL Server |
DELAYED_DURABILITY
|
DISABLED |
Nein |
| SQLite |
synchronous
|
2 (FULL) |
Nein |
Questions about synchronous_commit
What is the default value of synchronous_commit in PostgreSQL?
on. on (PostgreSQL 18).
Does changing synchronous_commit require a restart?
No. No restart. Any role can SET it for a session or with SET LOCAL for one transaction; a server-wide ALTER SYSTEM change applies after a reload (context is user).
When should I change synchronous_commit?
Turn it off per transaction (SET LOCAL synchronous_commit = off) for data you can afford to lose, such as logs or metrics, to cut commit latency without risking the rest.
Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.
Check synchronous_commit on your own server
SQLly runs the query above against PostgreSQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.