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: Combine freezing and pruning steps in VACUUM
Date: Wed, 03 Apr 2024 16:34:32 +0000
Message-ID: <E1rs3ZH-000KAy-Rz@gemulon.postgresql.org> (raw)

Combine freezing and pruning steps in VACUUM

Execute both freezing and pruning of tuples in the same
heap_page_prune() function, now called heap_page_prune_and_freeze(),
and emit a single WAL record containing all changes. That reduces the
overall amount of WAL generated.

This moves the freezing logic from vacuumlazy.c to the
heap_page_prune_and_freeze() function. The main difference in the
coding is that in vacuumlazy.c, we looked at the tuples after the
pruning had already happened, but in heap_page_prune_and_freeze() we
operate on the tuples before pruning. The heap_prepare_freeze_tuple()
function is now invoked after we have determined that a tuple is not
going to be pruned away.

VACUUM no longer needs to loop through the items on the page after
pruning. heap_page_prune_and_freeze() does all the work. It now
returns the list of dead offsets, including existing LP_DEAD items, to
the caller. Similarly it's now responsible for tracking 'all_visible',
'all_frozen', and 'hastup' on the caller's behalf.

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/6dbb490261a6170a3fc3e326c6983ad63e795047

Modified Files
--------------
src/backend/access/heap/heapam.c         |  67 +--
src/backend/access/heap/heapam_handler.c |   2 +-
src/backend/access/heap/pruneheap.c      | 761 +++++++++++++++++++++++++++----
src/backend/access/heap/vacuumlazy.c     | 435 +++---------------
src/backend/storage/ipc/procarray.c      |   6 +-
src/include/access/heapam.h              |  85 ++--
src/tools/pgindent/typedefs.list         |   2 +-
7 files changed, 813 insertions(+), 545 deletions(-)



Message-ID: <E1rs3ZH-000KAy-Rz@gemulon.postgresql.org>
Permalink:  ../E1rs3ZH-000KAy-Rz@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rs3ZH-000KAy-Rz@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: Combine freezing and pruning steps in VACUUM
  In-Reply-To: <E1rs3ZH-000KAy-Rz@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