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.94.2) (envelope-from ) id 1sFuew-007Ibq-Cp for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Jun 2024 11:54:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sFueu-00Go3R-VH for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Jun 2024 11:54:57 +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.94.2) (envelope-from ) id 1sFueu-00Go3J-Jx for pgsql-hackers@lists.postgresql.org; Sat, 08 Jun 2024 11:54:57 +0000 Received: from mail-ua1-x933.google.com ([2607:f8b0:4864:20::933]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sFuet-000bib-Ez for pgsql-hackers@postgresql.org; Sat, 08 Jun 2024 11:54:56 +0000 Received: by mail-ua1-x933.google.com with SMTP id a1e0cc1a2514c-80b8e5cab7bso56982241.0 for ; Sat, 08 Jun 2024 04:54:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717847694; x=1718452494; 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=3/ZuD2Y85vu0L182hYtKr2JcMNHRTHZSgh0aSwSkPG8=; b=R7u7LyPhYPDAWT3xgt45TM4gDcDkvNZJvTNlBUKEc6ZLju60NUW0uxn/usEL14Of8W E59CHl9PwYwdptT1Gmfio8w+gYWSV/xZGS4NM24/GHppAOniAAXoOZLDj8FDubqyteNe lXqFoyvT6C2KJpN0ZsuCaeDd8PmtMwCE5cj7jzIngEvjZAc5t3QnG8kgCzSsfLPcPkzH OEACp52E+72q4+ozaRspjepaBpQsfqYiFcMebjdNqG4DHOjMeXW/inRndFu0gFg3ozoJ Yt3OWAvQQ9c7c6UTQDPV0dzA2jVuuqwjw6pRwbiTm6k8MgqFMOnW6AjdOGSziRM2n1h1 jhbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717847694; x=1718452494; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3/ZuD2Y85vu0L182hYtKr2JcMNHRTHZSgh0aSwSkPG8=; b=RzeC2Xf4WX2IQOQa+1ztjOVpov5DJPfdSl+SCb2bkUcSelUHrjeTcVfrQYbq7eASCE 7TAwDb161WDk5A2NI7+qCKtSN0Fokfw1EsJwgQilAEI01SMlYu2g1See6P+RMFsxANFt PpJbit0djlrO63XNKvkTJOKa0WId4K4sDmPQ4y/8OSd5l8d5rbm2d0jTnv6SEGE6Myvf 75q/B1ydLeMy0U9OHxg6gsbYaEVOPgisLM4w4NrwjYA+iGVa2HxLw3GakT0XL4pYnmOG FR/kU8HbsAc2os1iAiVJJAFYHKOf1VOM2ZyaXIehHwL2XRB+8WcfApz4q3jPIURUp64H JPiA== X-Forwarded-Encrypted: i=1; AJvYcCVY26xP43Saed0LWKcQTgQNTXScefcJJQ+rmISVPkPotxGbuuGM9eyN54N2sk4s/wwu+IFvwEfk6Tdn0HuSSIXxYjdKiOCNGjqt8tcY X-Gm-Message-State: AOJu0YysUERPfi0sYnzzUvaP+mW0gpeoYjkgQaSZyGssUxKwS2vOpi6/ egcvctZCW4dyyRqtO4Giop9eOj+xkDXei6Puw6gkxb42MSOOA/ngzwWAIJx+cq6P0NQjMR4A9J5 b374bNuVN5TP5ZBznYEKWgkMMMD4= X-Google-Smtp-Source: AGHT+IFZfkXL+6Zf1LrV1HnuagHAGKygsrF9/OtzdSjxjd7nB5EVxfZtT74pqbLHZLBl0cZE1KVsNuploG74zpdTd6w= X-Received: by 2002:a05:6102:19d4:b0:48c:3789:b65 with SMTP id ada2fe7eead31-48c37890bdfmr2771678137.1.1717847693655; Sat, 08 Jun 2024 04:54:53 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nitin Jadhav Date: Sat, 8 Jun 2024 17:24:17 +0530 Message-ID: Subject: Re: Use WALReadFromBuffers in more places To: Bharath Rupireddy Cc: Jingtang Zhang , PostgreSQL-development 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 Bharath, I spent some time examining the patch. Here are my observations from the re= view. - I believe there=E2=80=99s no need for an extra variable =E2=80=98nbytes= =E2=80=99 in this context. We can repurpose the =E2=80=98count=E2=80=99 variable for the same= function. If necessary, we might think about renaming =E2=80=98count=E2=80=99 to =E2= =80=98nbytes=E2=80=99. - The operations performed by logical_read_xlog_page() and read_local_xlog_page_guts() are identical. It might be beneficial to create a shared function to minimize code repetition. Best Regards, Nitin Jadhav Azure Database for PostgreSQL Microsoft On Mon, May 13, 2024 at 12:17=E2=80=AFPM Bharath Rupireddy wrote: > > On Wed, May 8, 2024 at 9:51=E2=80=AFAM Jingtang Zhang wrote: > > > > Hi, Bharath. I've been testing this. It's cool. Is there any way we cou= ld > > monitor the hit rate about directly reading from WAL buffers by exporti= ng > > to some views? > > Thanks for looking into this. I used purpose-built patches for > verifying the WAL buffers hit ratio, please check > USE-ON-HEAD-Collect-WAL-read-from-file-stats.txt and > USE-ON-PATCH-Collect-WAL-read-from-buffers-and-file-stats.txt at > https://www.postgresql.org/message-id/CALj2ACU9cfAcfVsGwUqXMace_7rfSBJ7%2= BhXVJfVV1jnspTDGHQ%40mail.gmail.com. > In the long run, it's better to extend what's proposed in the thread > https://www.postgresql.org/message-id/CALj2ACU_f5_c8F%2BxyNR4HURjG%3DJzii= z07wCpQc%3DAqAJUFh7%2B8w%40mail.gmail.com. > I haven't had a chance to dive deep into that thread yet, but a quick > glance over v8 patch tells me that it hasn't yet implemented the idea > of collecting WAL read stats for both walsenders and the backends > reading WAL. If that's done, we can extend it for WAL read from WAL > buffers. > > -- > Bharath Rupireddy > PostgreSQL Contributors Team > RDS Open Source Databases > Amazon Web Services: https://aws.amazon.com > >