comparison Data & storage
Synchronous versus asynchronous database replication
In PostgreSQL 18, asynchronous replication needs no standby reply. With a synchronous standby selected, the primary waits for its own flush plus the standby’s OS write, durable flush, or replay, depending on the commit policy.
What it means
In PostgreSQL 18, “synchronous” does not necessarily mean a standby has applied your write. The primary can wait for the standby to write the commit record, flush it to durable storage, or replay it. With asynchronous replication, the primary does not wait for a standby reply, but it can still wait for its own durable flush. Commit settings · Standby replication
To interpret an acknowledgment, start with the commit’s position in the write-ahead log (WAL). The question is not just “Did the record get there?” but “Which standby, if any, had to report which milestone through that position?”
Try it
Use synthetic values only. This local simulation does not connect to a database or perform a commit.
Synchronous versus asynchronous database replication
Step through primary log, replica receive/flush/apply stages under named acknowledgement policies; interrupt one stage and distinguish evidence states.
Local simulation only: no device, service, stored object or database is changed, and no real operation is authorized.
The required local flush and remote written milestone are established in this fixture.
Commit acknowledgment is not necessarily replay visibility
- Remote milestone required
- written
- Acknowledgment condition satisfied
- Yes
- Remote durability evidence
- No
- Known write applied on replica
- No
Evaluated evidence
- Commit position (position units)
- 10
- Primary flushed position (position units)
- 10
- Replica received position (position units)
- 10
- Replica OS-written position (position units)
- 10
- Replica flushed position (position units)
- 8
- Replica applied position (position units)
- 7
- PostgreSQL synchronous_commit policy
- remote_write
- Synchronous standby configuration
- one-required
- Required standby available
- yes
- Durability-settings evidence
- verified
PostgreSQL18, one configured synchronous standby, one WAL history, supported durability settings. Positions and reply evidence are stipulated; applied=>flushed is an explicit restricted state chain. No real commit or performance measurement.
About this model
Every input is local synthetic evidence. Numbers stay as raw text until this model validates them. The shown evaluated values come from the same result as the explanation.
Presets replace the entire scenario. Reset restores all starting fields, scenario selection and model state; it does not change the open or closed state of this help or article FAQ.
No external request, device command, stored-input history or measurement is performed.
Start with Synchronous standby configuration set to one-required, Required standby available set to yes, and Durability-settings evidence set to verified. The example uses one WAL history. Commit position and Primary flushed position are both 10. On the selected standby, the four positions, in position units, are:
- Replica received position: 10
- Replica OS-written position: 10
- Replica flushed position: 8
- Replica applied position: 7
With PostgreSQL synchronous_commit policy set to remote_write, the acknowledgment condition is satisfied. The primary has flushed through 10, and the standby has reported an OS write through 10. It is the write report, not receipt of the bytes, that satisfies the remote wait. The commit at 10 is not yet durably flushed on the standby (8) or applied there (7).
Choose Wait for remote flush, not OS write. The positions stay the same, but the policy changes to on: flush through 8 falls short of 10, so the commit must wait. Raising Replica flushed position to 10 satisfies on. If you then switch to remote_apply, the commit must still wait because replay is only at 7.
The Inspect the evidence boundary preset poses a different question. It uses remote_write and sets Replica OS-written position to unknown. Receipt through 10 does not tell you whether the OS write reached 10, so the answer is unknown. Enter 9 instead and the answer is no: now there is evidence that the required write is short of the commit.
Enter positions as whole-number decimal strings without spaces, fractions, or exponents: 1–1000000 for the commit and 0–1000000 for progress positions. Only the progress positions accept unknown in place of a number. The simulation restricts known standby positions to applied ≤ flushed ≤ OS-written ≤ received. A flushed position of 11 with an OS-written position of 10 is invalid, not evidence of delay. Reset restores all starting inputs and the default scenario, returns the step and virtual time to zero, and clears errors, history, and comparison.
In practice
Check synchronous_standby_names before interpreting synchronous_commit. No standby configured and a required standby unavailable are different conditions. With an empty synchronous_standby_names, every non-off policy waits only for the primary’s local flush. With one standby required but unavailable, a policy requiring its reply can leave the commit waiting; the remote requirement does not disappear. Commit settings · Synchronous replication
With one synchronous standby selected and available, remote_write, on, and remote_apply all require the primary’s local flush. Their additional waits are for the standby’s OS write, durable flush, and replay, respectively. By contrast, local waits for the primary flush but no standby reply; off waits for neither. Commit settings
| Observed milestone | Additional fact not implied |
|---|---|
| Receive | Durable standby storage |
| OS write | Standby storage flush |
| Flush | Replay/apply completion |
| Apply | Visibility in every already-open read snapshot |
If a read on a standby must include this commit, check replay through the commit position on the standby that will serve the read, and use a read snapshot that can include it. A low lag estimate is not that check. This is a read-routing decision, not a test of whether a standby is safe to promote. Interpret the acknowledgment only as evidence of the milestone its configuration required.
Frequently asked questions
Editorial questions based on the listed sources and explicitly labeled local examples.
Does synchronous always mean replayed?
Not in PostgreSQL 18’s distinct acknowledgment modes. Waiting for remote flush is different from waiting for replay; remote_apply adds the apply milestone. The model keeps received, written, flushed and applied positions separate.
What does remote write acknowledge?
It waits for the selected standby to write the record to its operating system, not merely receive bytes. That does not itself prove the standby has flushed durable storage or applied the record for reads.
What if no synchronous standby is configured?
With an empty synchronous_standby_names configuration, non-off modes reduce to the documented local waiting behavior. That differs from a configured required standby that is absent: the latter can leave the acknowledgment waiting.
Does this model prove failover is safe?
No. It checks one acknowledgment boundary under explicit durability assumptions. Promotion, timelines, quorum selection, split-brain prevention and application recovery are outside the model.
Sources & model boundaries
Primary references used for this explanation. The interactive example is an educational model, not a live check.
- Write-ahead log runtime configuration
synchronous_commit. remote_write waits for standby OS write, not merely receipt; on waits for flush and remote_apply for replay. Empty synchronous_standby_names changes waiting semantics.
Checked .
- Log-shipping standby servers
Streaming replication; synchronous replication; compatibility. Standby progress and acknowledgment policies are separate; asynchronous progress can lag the primary. Physical log shipping has version/platform constraints.
Checked .