Low-traffic Postgres read replicas can lag because they may wait up to 60 seconds for a WAL segment to be shipped. ClickHouse’s engineering team tested ways to shorten that delay, and recommends two settings as a starting point: archivetimeout=5s and walretrieveretryinterval=500ms.
ClickHouse Watch analysis
What happened
In a new ClickHouse engineering post, the team describes tests on ClickHouse Managed Postgres using a primary database and a read replica. With the default settings, WAL segments are switched every 16MB of changes or 60 seconds, whichever comes first. Under light write traffic, that timer can leave a replica waiting for an update; under moderate load, the team measured about three seconds of lag at 12MB/s.
The post recommends trying a five-second archive timeout and a 500-millisecond retry interval when replica lag matters. ClickHouse says lowering those values further brought diminishing returns in its tests. Forcing frequent WAL switches also increased overhead: the team measured primary throughput falling by about 15% with its switch loop running.
Why it matters
Read replicas help handle read traffic separately from writes, but their value depends on how fresh their data is. This account gives Postgres operators a practical explanation for a surprising result: a replica can look slow in a lightly loaded test precisely because there is not enough traffic to trigger a WAL segment switch promptly.
The suggested settings are not free. ClickHouse warns that shorter archive intervals can increase network use, particularly with synchronous high-availability standbys, and that replicas may repeatedly fetch and decompress archived segments. The tests used small instances, so the costs and best settings will vary by deployment.
Our read
The useful part is the connection between the symptom, the timer and the trade-off. Before treating a quiet test as proof that a replica is inherently sluggish, operators can check whether WAL shipping is waiting for the timeout. The suggested values are a starting point to test, not magic numbers to paste into production and admire from a safe distance.
What to watch
- Whether operators see lower lag after testing the suggested settings against their own workload.
- How much extra network traffic and replica CPU the shorter intervals create.
- Whether ClickHouse publishes results from larger production-grade instances.
Discussion spark: When tuning read replicas, would you accept higher network and CPU costs for fresher data, or keep longer lag if the faster setting only matters under light traffic?
Sources and evidence
- Source update (18 November 2026, 09:23 UTC)
Independent WittyWires tracker for public updates about ClickHouse. Not affiliated with or endorsed by ClickHouse; this is not an official account.