Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w46uk-001sMB-1U for pgsql-hackers@arkaria.postgresql.org; Sun, 22 Mar 2026 00:43:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w46uh-00C8Vz-1c for pgsql-hackers@arkaria.postgresql.org; Sun, 22 Mar 2026 00:43:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w46uh-00C8Vr-0U for pgsql-hackers@lists.postgresql.org; Sun, 22 Mar 2026 00:43:31 +0000 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w46ue-00000000QQg-1kGt for pgsql-hackers@postgresql.org; Sun, 22 Mar 2026 00:43:31 +0000 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-67c2db63127so716282eaf.2 for ; Sat, 21 Mar 2026 17:43:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774140206; cv=none; d=google.com; s=arc-20240605; b=Y49BVCNFW5OZCLFKV5j95ZrQf4CbJsM9uuFD4F8QVYxdh4CWS9bNUCCNyR2ponI0ZC o8/VgLg9utJaYaxNjlXFwViSpd8ySCBuDmzPO0FKhT/+vjaWG/JEK8I1zPzurp76jpfz QkG15lKm1/gg0Tuyj3HMuLytkl0cUS5zCcLI8EqTt/iD7o3bi1YbmEsA232tksLz1m2e nG1KyVcMOHHDtEoT1mx5D3gUJ44kIsmZNq6XKaMqWwaQt7gonDdsZodl76XD10txvy7N a/tvYyPZRVZ7ImmYZ/0mQDgjc1jBQkrRBYWe7rg2/3TAsijOGeSHp69bURPmoxKP53Pr 0krg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/TA1+DIdstXpX9rbOPolUpzTS/mHDStri3YCt1eW5z0=; fh=aYYSzdIVr9xbBGy+6opifo/rfhjpqedKtH4ZGmoSqTI=; b=Ew/IWxW7N2cm+hfMHbQW8656k/osMRfyJWsF5Xhrp0Ge0YJzFoVXl6XepdMMYUlCuE ENXg4JsaNeD7vWX6bdAkLJnlQGISbqqGrXuAtwhka8ZYWzXRLQhgHS1JJLwB+yN3NIpW SMbtvujBga2rxsJxOs5e01ORNNFdIfHkJx92dINSqj/w4bD4EAg5iUfXWk1zLczNWEKj TZ+0IbygRoj+D8q3ZtDNKO/FoTW7TtfK0MYhLo39o42kgUMhj8iJyjKYMcnw/dZEq1TQ sYFaT7G9xl18a3FIdzN1Mrch78nvhQS/77Z74LX1+7/Xtvymltwjw20RJEQeZGGTLfuG k/7w==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1774140206; x=1774745006; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=/TA1+DIdstXpX9rbOPolUpzTS/mHDStri3YCt1eW5z0=; b=XxpN3fUmn6WXvBjORl0x9n1h+hQnkFsrD9719fTYY4nQxEKP1frwCCMmhE9g635iTb f0tQ1NOGwe0cvqqvjEvqRDmHWi3wglWyfi0itFZlT3W0in++bgY6/DZ1yTWikmqpRJQ2 HvCrMdkx3DiftAuZ5ktuxY22Wkb8XyItoW9CebzdZaJTkegRH703ovffSOAjA7y1PPFg qtSQYVHGF/ZZPPPwVZBIulCywkYfZ3o3pCZm8VRAteLV9vTYn+NUTLMzdsCZoXRN/CWW fgdJjC+7ruZ8zd8P7kJdW/2uphVBKCTvURumF6TcmrvnF0nGu7Ff2WUXLgqhmxO8fCFc +BUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774140206; x=1774745006; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=/TA1+DIdstXpX9rbOPolUpzTS/mHDStri3YCt1eW5z0=; b=CSLneugViCeU4Jfff2dArgXx9merKO9aryVsFrzjRo60n3+D+8f4f79fdr7y2yr08t wOqyCMUZdQWnUjlRXBbvXFoJhw2HeDRaweP9D42hEcT9ul9dxF6RrfvpIMX/Ryn8b0PW P3NdCdwLukdgw1s7af715MaCRmfwkU2L+30Iwph23J2BwZgdwrVtidKDOGCw5pTuS0Cv nHTw3lDRpqteZe071635RLkiVDWZBvzcXkHreknWkQyLIEA1NUZs8q6lf33bQQdBJ3HF htz4uMmZOB0lOFvM/86wOUzpV70gWR03dqWhA1s83A+LfaHqTOM+FvxH9FLh/0Gouae6 CdTQ== X-Forwarded-Encrypted: i=1; AJvYcCXRwJseLz8netJjZodKJGanW0wdGMO061mBYBjiW79AIJsYxpsb+4hAQikgjDCsifiCaeesosDj2MNvVvo1@postgresql.org X-Gm-Message-State: AOJu0Yz/R0YLy2juGZpPxudjkn11JwJaIvS1irU5xiqqdHbZyR3pyTpw +zGnkchDCNBqFt7axqc6ehWP9UXazJNqRx4cYGYtCwUhFf82wRqVrumZZpxmlOuUD9Vdq3uYtxG iLz41O3qhHfzmX/VjNNPnVZVssQLYXftmVMPp X-Gm-Gg: ATEYQzzX0NBCBpBT3pgkkobvdV8HRP8kPCQ8AInK9nCmkKL5pc1ti0F3kHh4g22NBPS 31Y3iMG9nydXTFggOlGqseHhj/g5wOe5zaIytj1/n8wriB37xlkLl9n0P17lI1pJphHjvAsiLMW 8jYS1xr9Y3aQCX8h80AnXg/xaZUPmq4t/bc+jH/e8Ea5MUf0PZWlJXGmCF4jwvIeU0ymNRdHlZy f/1FyxCydtp5vyOLyaFQeWZaBIWVZBHCiGb6B1wezmcy6xfbYNp2Vi84R7jG8bHDYDasClKj1LA leSsXA== X-Received: by 2002:a4a:e847:0:b0:67b:f208:9ad2 with SMTP id 006d021491bc7-67c22f73139mr5631408eaf.33.1774140206349; Sat, 21 Mar 2026 17:43:26 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bharath Rupireddy Date: Sat, 21 Mar 2026 17:43:15 -0700 X-Gm-Features: AaiRm51ZcdGCAhAIMfQi1YYGiqTA70lvL_Wjt8pcv7XBNosGuQ4XeJkXHK4ap3Q Message-ID: Subject: Re: log XLogPrefetch stats at end of recovery To: SATYANARAYANA NARLAPURAM Cc: Lakshmi N , pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Sat, Mar 21, 2026 at 1:16=E2=80=AFAM SATYANARAYANA NARLAPURAM wrote: > > > While investigating a long recovery, I noticed that XLogPrefetch stats = were not logged at the end of recovery. This log message will be useful to = understand how effective XLogPrefetch was during recovery. Adding a patch t= o address this. > > Applied this patch and validated the log message. This log message appear= s to be useful to me, particularly while doing fleet wide analysis. > > 2026-03-20 23:33:13.756 PDT [2265441] LOG: XLogPrefetcher stats: prefetc= h=3D14, hit=3D6, skip_init=3D5, skip_new=3D28, skip_fpw=3D18, skip_rep=3D99= 6 This looks useful to understand how the prefetch helped during long recover= ies. > I am wondering if we can periodically log this in standby mode as well, n= ot just before promoting? Timer-based startup progress messaging allows logging such things (ereport_startup_progress API). There was an attempt to enable "redo in progress" for standbys, but that seemed to flood the standby logs even at the default progress interval of 10 sec. Having said that, the prefetcher stats could be added to the existing ereport_startup_progress("redo in progress xxx") message that works for crash recoveries=E2=80=94however, I don't prefer doing a bunch of atomi= c reads every progress interval of 10 sec. Therefore, logging at the end of recovery looks good to me. I reviewed the patch. I have the following comment: + elog(LOG, "XLogPrefetcher stats: prefetch=3D%lu, hit=3D%lu, skip_init=3D%lu, skip_new=3D%lu, skip_fpw=3D%lu, skip_rep=3D%lu", XLogPrefetcher is an internal data structure name, how about "redo prefetch stats: xxxx" to be consistent with other redo log messages? -- Bharath Rupireddy Amazon Web Services: https://aws.amazon.com