Part 2 of 5 · 1 min read
Replication lag, and read-your-writes
An asynchronous follower is always somewhat behind; read-your-writes specifically guarantees a user sees their own just-made write.
Think of mailing a letter to a friend and then calling them five minutes later, before the letter could possibly have arrived, asking whether they received it yet.
In plain words: replication lag is the delay between a write committing on the leader and that same change actually being reflected on a given follower, an unavoidable consequence of asynchronous replication covered on the previous page. Read-your-writes is the specific guarantee that a user who just made a write will see that write reflected the next time they read, even if their read happens to be served by a lagging follower. Without this guarantee, a user who updates their own profile picture, then immediately reloads the page, could see their old picture if that reload happened to hit a follower that had not yet caught up.
A worked example. A user updates their profile bio, and their very next page load is served by a follower that has not yet received that specific update, briefly showing the old bio right back to the very user who just changed it.
The key lines. No new SQL; replication lag and read-your-writes are both properties of how reads are routed relative to a specific user's own recent writes, not something a single query statement controls.
Replication lag, read-your-writes
Replication lag is the delay before a follower reflects a change already committed on the leader; read-your-writes guarantees a user sees their own just-made write on their next read, regardless of that lag.
Example: calling a friend to ask about a letter mailed minutes ago, before it could possibly have arrived, mirrors replication lag; guaranteeing the friend definitely has it by the time asked is read-your-writes.