pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: bufmgr: Add one-entry cache for private refcount
Date: Sun, 14 Dec 2025 18:16:39 +0000
Message-ID: <E1vUqe6-000lAT-1V@gemulon.postgresql.org> (raw)

bufmgr: Add one-entry cache for private refcount

The private refcount entry for a buffer is often looked up repeatedly for the
same buffer, e.g. to pin and then unpin a buffer. Benchmarking shows that it's
worthwhile to have a one-entry cache for that case. With that cache in place,
it's worth splitting GetPrivateRefCountEntry() into a small inline
portion (for the cache hit case) and an out-of-line helper for the rest.

This is helpful for some workloads today, but becomes more important in an
upcoming patch that will utilize the private refcount infrastructure to also
store whether the buffer is currently locked, as that increases the rate of
lookups substantially.

Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/6rgb2nvhyvnszz4ul3wfzlf5rheb2kkwrglthnna7qhe24onwr@vw27225tkyar

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/30df61990c67f0cf7450e36c1e038d513960f148

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c | 66 ++++++++++++++++++++++++++++++-------
1 file changed, 55 insertions(+), 11 deletions(-)



Message-ID: <E1vUqe6-000lAT-1V@gemulon.postgresql.org>
Permalink:  ../E1vUqe6-000lAT-1V@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vUqe6-000lAT-1V@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: bufmgr: Add one-entry cache for private refcount
  In-Reply-To: <E1vUqe6-000lAT-1V@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox