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 1w4dU1-002OMt-12 for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Mar 2026 11:30:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w4dTz-00HIPS-2m for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Mar 2026 11:30:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w4dTz-00HIPI-1r for pgsql-hackers@lists.postgresql.org; Mon, 23 Mar 2026 11:30:07 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w4dTx-00000000cFr-1Ugt for pgsql-hackers@postgresql.org; Mon, 23 Mar 2026 11:30:06 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5a13e1cfa45so3023355e87.2 for ; Mon, 23 Mar 2026 04:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774265404; cv=none; d=google.com; s=arc-20240605; b=IN135iCBIj6kj/5QIWhcqM6Qq7vSfTsb0CwXXtKc/H56W3fMpcKOylew0rDo3Rhhm3 UxuQ7bbDTehcpQBujg6nFVS69voKCdooTMGStXZEdQkaozYUguQOZM5FD+DjR911WCC/ u2Q0usnSfZbWjbprLC+hi4Xd4T2cjim+bM/FevseM8C95Ofl5H9BV0nIB1k+c0TDvei6 5jla8GcEqO/CY2whiRX4HGIYFmhkwZJyCMA+RM3n2KhZqtuCzssrbHdUCmAzyGyM6dOb f6OmXla5pXFEX9nuBOVk3rQwcBnQ6uPrMyHiANUjPismD7GKRM+eimTydY4agKXeuWXI xZmw== 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=wJqpJ4/1NAn9Z7t6IjXwj7pxlGK65Yj2+Ah0x0+TvmE=; fh=lJxgY2sPDmE4Azqc67gX17FrcOAf4iM8+9UPkXOqfNc=; b=d+TX2pS7RgEk7UZ/GZAnNeimK3FVbOtvgATJyOKcRUux3pB0y5sMJGuxL2gM+gIY+A UjRlIFjg6hsjWe4O7Dd1H3agVcjFqZSHf4o8ipbE2KpBom8uw5TOcwiys9ZMWCSk8yCH SR8a4PyTIlGIVS70p5rn36nsC7Ln5DgPW3CrREF/7dxVkxDW0BQ3OXG/VnKNSRWVL6Ui w+qVq/C8HU/FUxCZdBp7pe2Rz98zNcuR0Si/CCNXKjzRmPjbmCx1amW9uGNQC+gJX4ga i18XWUPAC+nNuY43YEqcgPz87xWfdhXxJHQA/ZXWpwOijwnPyyUeNp7ASZAc27viizQA IZKw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1774265404; x=1774870204; 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=wJqpJ4/1NAn9Z7t6IjXwj7pxlGK65Yj2+Ah0x0+TvmE=; b=UcXWVULmyS7Ax2L61UMIJtEnaSVMYNFt2Qz+Fg8vyYFKgpZ04X1z1iB3EYQNg10TAx pIvURyFqGkwUBdeapkB0p15zCLO9rmMNO1HSu6jpt+FF1c528iflpfHVHtIyP7A1/C6+ ll/Kakxt8xlYgEul1SBtjyrP94t1KGktICHPteTbCBhLJNlJAenSvNyQltH1HgqMRRfU B2t0/JTaF0k3n5ySw8kP9LYUzeRGX1pxLKrw/kTsg3cWizbJIqEsttJTI2j4D7XFh3mt AjLHAOCpQPkBhNweJm3tmW9SanwBfTaSSjfxmOxzz+FKib6m3XNQkzUl67rg98OhPQoZ xj+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774265404; x=1774870204; 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=wJqpJ4/1NAn9Z7t6IjXwj7pxlGK65Yj2+Ah0x0+TvmE=; b=NezDiDq+ZbTjtU8ZJm6k5aVzU3Nx3fwacIqVCk31LwaFN0ql8J6HKTE8B3Dr/wruun 6IkT/+Ygaj+LhfGAm+Q0ok9o6t6Xir01NTMIUlqJ18mfYbY+xBbhrEBkzFtvNb/1EjSA xp99zwdsqkQQBDQOyZTxXPVYauPR4Pkw2/s12XYDTkQLcVRYsq+6Clt/inuxxalxfrng 8m//GDXCe/DZVyS748DhdJnjVX21CuYlRK/y58PkaD6IuUJzDDjTVPlYPEg+4mVpTmhS WCtSybJQQvtSeh8WTsYxgKDzQL16TBv0wwJV1ILKTkiaV+ntqiGmihFRpVJE71TQm9Ri yRfw== X-Forwarded-Encrypted: i=1; AJvYcCV8OecktAFppfAQbXOspOSru7HD1Wz71XeKqt0rJC3G4/Su3kvlM3Y4k5iU4paw38DluFIfeA/kpn3so2sM@postgresql.org X-Gm-Message-State: AOJu0Yz+Sx9tl17Vwf9Xy+btbl1LgGQ8xO9HD94GzF/AhgLzcZP7IMyf 5ORHwbQZZBzJnpaZ0HJPUuxR/WnP2gzHBmnemMD/bWCDDByEIXAqBQi2vyPspOBiERhDKKZgj5x Fv8/kLDIJjcknfuhlOzwyQbMMV8SNr4PojdvcP81d X-Gm-Gg: ATEYQzzQTEhABylGYo5HKpBvdOdFGzxu8/U2nSe0QaWY3gTw9UDrZILbt3pqQs++rNh 4Kw7QMsKBlux1P8CnQ/I7dzebAL88HeavsQ+IlOjyIgFhbGFbYc9SHWXB1coYcZsUptymmos6wJ FZAZ8idlH2LkTdKx0aHErUlfGEKwNgPxuMEF4/5/U/ZzSB+QBMAzWf+rQt6GC+F+wPlGSOrQQDI OhX5qvtscCGFgkk2QDPxbDEREoXwmZsLOFAYYSBxqGKVaMiktcfB5CnjWXXsTxNAsnfEDaegvYD 98y6uS8hiNUjrCZSQh6DsrImMAUPzFfB3xiEyZBVt4xtdsgu2YfcchLcA4nmSNS1v6k= X-Received: by 2002:a05:6512:2305:b0:5a1:3b7f:450e with SMTP id 2adb3069b0e04-5a285b83c00mr3748509e87.42.1774265403518; Mon, 23 Mar 2026 04:30:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jakub Wartak Date: Mon, 23 Mar 2026 12:29:50 +0100 X-Gm-Features: AaiRm50nlvAoJbhuOZbtgFvB-oBv-SgMeA-uXi4xIuIyBWbHRbxt6MKGQiuo3R0 Message-ID: Subject: Re: log XLogPrefetch stats at end of recovery To: Bharath Rupireddy Cc: SATYANARAYANA NARLAPURAM , 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 On Sun, Mar 22, 2026 at 1:43=E2=80=AFAM Bharath Rupireddy wrote: Hi, > On Sat, Mar 21, 2026 at 1:16=E2=80=AFAM SATYANARAYANA NARLAPURAM > wrote: > > > > > While investigating a long recovery, I noticed that XLogPrefetch stat= s were not logged at the end of recovery. This log message will be useful t= o understand how effective XLogPrefetch was during recovery. Adding a patch= to address this. > > > > Applied this patch and validated the log message. This log message appe= ars to be useful to me, particularly while doing fleet wide analysis. > > > > 2026-03-20 23:33:13.756 PDT [2265441] LOG: XLogPrefetcher stats: prefe= tch=3D14, hit=3D6, skip_init=3D5, skip_new=3D28, skip_fpw=3D18, skip_rep=3D= 996 > > This looks useful to understand how the prefetch helped during long recov= eries. > > > I am wondering if we can periodically log this in standby mode as well,= not 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 ato= mic > reads every progress interval of 10 sec. > Therefore, logging at the end of recovery looks good to me. +1 from me too to only of logging at the end of recovery (so -1 to logging every now and then). If someone is interested in current state (or progress over time) I think he can query pg_stat_recovery_prefetch view already, eve= n today, right? > 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? +1 -J.