# Detecting Replica Lag That Breaks Read-Your-Writes Consistency

DevFeed: [Detecting Replica Lag That Breaks Read-Your-Writes Consistency](<https://devfeed.tech/articles/the-replica-lag-you-do-not-measure-is-the-one-serving-checkout-39596.md>)

Original publisher: [Read original article](<https://ankit-rana.com/logs/44-replica-lag-read-your-writes/>)

Author: hello@ankit-rana.com

Published: 2026-08-28T00:00:00Z

Content type: tutorial

Language: en

Sources: [Ankit Rana | Mechanical Sympathy](<https://devfeed.tech/sources/ankit-rana-mechanical-sympathy.md>)

Topics: [Replication](<https://devfeed.tech/topics/replication.md>), [Routing (disambiguation)](<https://devfeed.tech/topics/routing.md>)

Tags: [checkout](<https://devfeed.tech/tags/checkout.md>), [consistency](<https://devfeed.tech/tags/consistency.md>), [lag](<https://devfeed.tech/tags/lag.md>), [metric](<https://devfeed.tech/tags/metric.md>), [observability](<https://devfeed.tech/tags/observability.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [primary](<https://devfeed.tech/tags/primary.md>), [read-replica](<https://devfeed.tech/tags/read-replica.md>), [read-replicas](<https://devfeed.tech/tags/read-replicas.md>), [replica-lag](<https://devfeed.tech/tags/replica-lag.md>), [replication](<https://devfeed.tech/tags/replication.md>), [routing](<https://devfeed.tech/tags/routing.md>)

## AI overview

This article explains how read replicas can break read-your-writes behavior when applications do not route related reads to the primary or wait for replication. It compares byte lag with time lag, explains why idle systems can hide failures, and discusses replay delays caused by write bursts and long-running replica queries.

## Source excerpt

Byte lag between primary and replica reads zero on an idle primary even when replication is completely stuck, so the metric that looks healthiest is the one that hides the failure. Time lag measured from the last replayed transaction is the signal that stays honest. Adding a read replica silently removes read-your-writes, which means any flow that writes and then reads back needs either primary routing or an explicit wait for the replica to reach that write's log position.