# Postgres recovery_prefetch can silently stall writes for hours

Original title: Postgres recovery_prefetch can cause outages

> Hacker News story 50188614 · language: en · submitted 2026-10-21
> Web version: https://zeli.app/story/50188614
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 42 · by [plaur782](<https://news.ycombinator.com/user?id=plaur782>) · 💬 6
[original](<https://ardentperf.com/2026/10/20/postgres-recovery_prefetch-considered-harmful-and-causing-outages/>) · [HN discussion](<https://news.ycombinator.com/item?id=50188614>)

## Summary

A field report shows how Postgres's recovery_prefetch setting can turn a routine burst of writes into a production outage. Because full-page writes are now ubiquitous and synchronous replication is common, prefetching converts large sequential reads into 8k random reads, amplifying IOPS up to 16x on replicas. When a network glitch interrupts streaming, the standby falls into WAL-restore mode and won't resume streaming until it catches up — leaving writes hung for over 30 minutes. Disabling recovery_prefetch fixes it.

## Key quote

> The read IOPS amplification combined with Postgres design for synchronous replication is what turns recovery_prefetch into an actual outage-inducing killer.

## HN discussion (6 comments)

### [normie3000](<https://news.ycombinator.com/item?id=50205591>)

> Why are all the comments getting downvoted? Maybe this one will too? The other replies _look_ like they have substance, so some refutation would be helpful.

### [opservo](<https://news.ycombinator.com/item?id=50195046>)

> Worth noting the default is recovery_prefetch = try (since PG15 when it was added), so anyone on 15+ is running this without having chosen it.
>
> The part that makes this nasty on cloud disks is that it's latent. On a burstable volume the standby has headroom most of the time, so the amplified reads are invisible until the one day a write burst lines up with a network blip and the volume is already at its IOPS ceiling. Nothing in normal monitoring looks wrong beforehand.
>
> Things I'd check if you can't flip it off immediately:
>
> \- pg_stat_recovery_prefetch on the standby to see how much prefetching is actually happening vs being skipped
>
> \- replay_lag in pg_stat_replication, alerted on, not just graphed
>
> \- standby read IOPS against the provisioned limit during your biggest batch jobs
>
> \- if you have a single synchronous standby, that's the real outage multiplier here; ANY 1 across two standbys (as the author suggests) or accepting async for that tier changes "slow replica" back into "slow replica" instead of "primary stops taking writes"

### [deakmisra](<https://news.ycombinator.com/item?id=50205035>)

> The 16x IOPS amplification is the part that clicked. Prefetch turns the primary sequential writes into 8k random reads on the standby, so a cheap cloud disk hits its IOPS cap even when bytes-read looks fine. Combined with the standby state machine that will not go back to streaming until local WAL is fully replayed, a brief walreceiver blip during a bulk update becomes a half-hour write freeze on the primary. I would turn recovery_prefetch off on any sync replica sitting on provisioned IOPS, and keep a second standby with ANY 1 so one lagging node cannot stall commits.

---

## Cite

- Page: https://zeli.app/story/50188614
- Date: 2026-10-21
- Source: ardentperf.com (https://ardentperf.com/2026/10/20/postgres-recovery_prefetch-considered-harmful-and-causing-outages/)
- Hacker News: https://news.ycombinator.com/item?id=50188614

## Other languages

- zh: https://zeli.app/zh/story/50188614 · markdown: https://zeli.app/zh/story/50188614.md
- ja: https://zeli.app/ja/story/50188614 · markdown: https://zeli.app/ja/story/50188614.md
- ko: https://zeli.app/ko/story/50188614 · markdown: https://zeli.app/ko/story/50188614.md
- de: https://zeli.app/de/story/50188614 · markdown: https://zeli.app/de/story/50188614.md
- es: https://zeli.app/es/story/50188614 · markdown: https://zeli.app/es/story/50188614.md
- ru: https://zeli.app/ru/story/50188614 · markdown: https://zeli.app/ru/story/50188614.md
