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: Refactor heap_prune_chain()
Date: Mon, 01 Apr 2024 10:31:24 +0000
Message-ID: <E1rrEwm-006pOk-HK@gemulon.postgresql.org> (raw)

Refactor heap_prune_chain()

Keep track of the number of deleted tuples in PruneState and record this
information when recording a tuple dead, unused or redirected. This
removes a special case from the traversal and chain processing logic as
well as setting a precedent of recording the impact of prune actions in
the record functions themselves. This paradigm will be used in future
commits which move tracking of additional statistics on pruning actions
from lazy_scan_prune() to heap_prune_chain().

Simplify heap_prune_chain()'s chain traversal logic by handling each
case explicitly. That is, do not attempt to share code when processing
different types of chains. For each category of chain, process it
specifically and procedurally: first handling the root, then any
intervening tuples, and, finally, the end of the chain.

While we are at it, add a few new comments to heap_prune_chain()
clarifying some special cases involving RECENTLY_DEAD tuples.

Author: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://www.postgresql.org/message-id/20240330055710.kqg6ii2cdojsxgje@liskov

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7aa00f1360e0c6938fdf32d3fbb8b847b6098b88

Modified Files
--------------
src/backend/access/heap/pruneheap.c | 207 ++++++++++++++++++++----------------
1 file changed, 116 insertions(+), 91 deletions(-)



Message-ID: <E1rrEwm-006pOk-HK@gemulon.postgresql.org>
Permalink:  ../E1rrEwm-006pOk-HK@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rrEwm-006pOk-HK@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: Refactor heap_prune_chain()
  In-Reply-To: <E1rrEwm-006pOk-HK@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