PostgreSQL's recovery_prefetch feature found causing replication outages
A bug in PostgreSQL's recovery_prefetch feature has been tied to real-world production outages, including a case where a customer's physical standby server suffered replay lag of several hours. The issue stems from the prefetch code issuing unnecessary fadvise system calls even when a page was already available from a full-page image in the WAL, burning excessive CPU in kernel space. The underlying concern was flagged by PostgreSQL developer Stephen Frost in a February 2021 mailing list message, well before the feature shipped, but was not addressed at the time.
GoKawiil's interpretation of the reporting above, not reported fact.
The case illustrates how a known, discussed trade-off in open-source database development can resurface years later as an operational problem once a feature is widely deployed in production. It suggests that mailing-list concerns dismissed as unlikely to matter can still materialize under specific workloads, such as high-throughput bare-metal replication setups. The reported fix—disabling recovery_prefetch—implies the feature's performance benefits may not be reliable across all deployment configurations.
- PostgreSQL's recovery_prefetch feature has been linked to production replication lag of several hours on some servers.
- The root cause is redundant fadvise calls when pages are already restorable from WAL full-page images.
- A potential issue was raised on the postgres hackers list in 2021, over a year before the feature shipped, but was not acted upon.
Source: ardentperf.com — About Jeremy, 2026-10-21
Published there as: “Postgres recovery_prefetch can cause outages”
Read the original report → The summary and analysis above are GoKawiil's own, written from reporting by the source above. Facts and quotes belong to the original publisher.