A coordinator at a fictional community clinic corrects the room on an appointment and saves. The screen confirms the save. She opens the same appointment again to read the note to a colleague. The old room is still there. The write reached the primary database. The page she reopened was answered by a standby that had not yet replayed that commit. Nothing was lost. The second read simply looked at an older snapshot.

This is a read-your-writes problem. The person who made the change should see that change on the next read, even when other readers may still be served from a copy that is a little behind. A replica is useful because it spreads read traffic. It is a poor place to prove to someone that their own save just happened.

PostgreSQL's hot standby documentation describes the gap directly. Data on the standby takes some time to arrive from the primary, so the same query run nearly simultaneously on both servers might return different results. The standby is eventually consistent with the primary. Once the commit record for a transaction is replayed, the changes become visible to new snapshots on the standby. Until that replay, a correct save and a stale read can both be true. Source: PostgreSQL hot standby documentation.

Decide which reads must include the caller's own write

Not every query needs the primary. A public list of clinic services can tolerate a short delay. The screen that redisplays an appointment immediately after the coordinator saves it cannot. Write down the journeys where the same person, or the same open session, reads a record they just changed. Those journeys are the read-your-writes set. Leave unrelated reports and search pages on the standby unless a product requirement says otherwise.

A practical rule for the fictional clinic is small. After a successful update to an appointment, the following read of that appointment, in that session, uses the primary or another path that is known to include the commit. The weekly room schedule, opened by someone who did not just edit it, can keep using the standby. The distinction is the reader and the recency of their write, not a blanket ban on replicas.

Return the saved record from the write itself

The cheapest way to show the new room is to return it in the save response and let the interface keep that copy. The coordinator does not need a second query to paint the confirmation. This also avoids a race in which the follow-up read starts before the application has decided where that read should go. Keep the returned body aligned with what was committed. If the server adjusts a field, such as a normalized room code, the response should contain the stored value rather than only echoing the request.

A later refresh is a different moment. If the coordinator reloads after a minute, the standby will often have caught up, but often is not a contract. If the product promises that a reload shows the saved appointment, the reload still needs a rule. Read from the primary for a bounded time after the write, or accept a standby read only after it can see a token recorded with the commit. A token can be the transaction identifier or an updated-at value that the primary stored.

Do not pin every session to the primary forever

Sending all of one user's later traffic to the primary is simple and can be right for a short window. It becomes expensive if the window never ends. Record when the session last wrote, and which records were involved. Expire the preference. A coordinator who edits one appointment should not force every patient search for the rest of the day onto the primary. Scope the sticky read to the record, or to a few seconds, unless you have measured a reason to go wider.

Document what other people see. A second coordinator who opens the appointment during the lag may still see the old room. That is ordinary replica delay, and it is different from hiding the writer's own save. If both people are looking at the same record together, the product may need the primary for that shared record anyway. Say so in the design note so a later performance change does not move the read back onto the standby by habit.

Test the lag on purpose

A test that only uses one database will pass while production fails. Add a case where the write commits on the primary and the standby read is forced to run before replay. The writer's follow-up must show the new room. A second case should show that an unrelated reader may still see the previous room while lag remains. A third case should show the new room after the commit record is visible on the standby. Include a reload, not only the immediate response, if reload is part of the journey.

Watch the lag you already have. PostgreSQL exposes recovery progress so an application can tell that a standby is behind, but a graph of seconds of delay does not by itself fix the coordinator's screen. Use it to decide whether the bounded primary read is still enough, or whether the standby is too far behind for the journeys you left on it.

The useful outcome is modest. The person who saved the room can read the room they saved. Everyone else's copy can catch up a moment later. That split is the whole design.

For related delivery support, explore 4Minds Technology's API and backend development and cloud and maintenance. Record which reads must follow the writer's commit, and which reads may wait for the standby, so a later performance change does not erase the distinction.