From 0c4dc55a3988dd549f88059c1e862acbb4fafc0c Mon Sep 17 00:00:00 2001 From: Anastasia Lubennikova Date: Mon, 8 May 2023 21:39:24 +0100 Subject: [PATCH] Disable recovery_prefetch for Neon hot standby. Prefetching of blocks referenced in WAL doesn't make sense for us, because Neon hot standby anyway ignores pages that are not in the shared_buffers. --- control_plane/src/endpoint.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/control_plane/src/endpoint.rs b/control_plane/src/endpoint.rs index 6431f66e1c..cc5a7a4168 100644 --- a/control_plane/src/endpoint.rs +++ b/control_plane/src/endpoint.rs @@ -134,6 +134,7 @@ pub struct Endpoint { // port and address of the Postgres server pub address: SocketAddr, + // postgres major version in the format: 14, 15, etc. pg_version: u32, // These are not part of the endpoint as such, but the environment @@ -381,6 +382,11 @@ impl Endpoint { conf.append("primary_conninfo", connstr.as_str()); conf.append("primary_slot_name", slot_name.as_str()); conf.append("hot_standby", "on"); + // prefetching of blocks referenced in WAL doesn't make sense for us + // Neon hot standby ignores pages that are not in the shared_buffers + if self.pg_version >= 15 { + conf.append("recovery_prefetch", "off"); + } } }