pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Minor refactoring in heap_page_prune
Date: Mon, 01 Apr 2024 09:21:16 +0000
Message-ID: <E1rrDqu-006p45-Be@gemulon.postgresql.org> (raw)

Minor refactoring in heap_page_prune

Pass 'page', 'blockno' and 'maxoff' to heap_prune_chain() as
arguments, so that it doesn't need to fetch them from the buffer. This
saves a few cycles per chain.

Remove the "if (off_loc != NULL)" checks, and require the caller to
pass a non-NULL 'off_loc'. Pass a pointer to a dummy local variable
when it's not needed. Those checks are cheap, but it's still better to
avoid them in the per-chain loops when we can do so easily.

The CPU time saving from these changes are hardly measurable, but
fewer instructions is good anyway, so why not. I spotted the potential
for these while reviewing Melanie Plageman's patch set to combine
prune and freeze records.

Discussion: https://www.postgresql.org/message-id/CAAKRu_abm2tHhrc0QSQa%3D%3DsHe%3DVA1%3Doz1dJMQYUOKuHmu%2B9Xrg%...

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9917e79d995c845adfe9b6cb3ea5cb7af7cec654

Modified Files
--------------
src/backend/access/heap/pruneheap.c | 37 +++++++++++++++----------------------
1 file changed, 15 insertions(+), 22 deletions(-)



Message-ID: <E1rrDqu-006p45-Be@gemulon.postgresql.org>
Permalink:  ../E1rrDqu-006p45-Be@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rrDqu-006p45-Be@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: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Minor refactoring in heap_page_prune
  In-Reply-To: <E1rrDqu-006p45-Be@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