pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Masahiko Sawada <msawada@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix missing FSM vacuum opportunities on tables without indexes.
Date: Wed, 02 Jul 2025 06:27:43 +0000
Message-ID: <E1uWqwZ-004JFX-11@gemulon.postgresql.org> (raw)

Fix missing FSM vacuum opportunities on tables without indexes.

Commit c120550edb86 optimized the vacuuming of relations without
indexes (a.k.a. one-pass strategy) by directly marking dead item IDs
as LP_UNUSED. However, the periodic FSM vacuum was still checking if
dead item IDs had been marked as LP_DEAD when attempting to vacuum the
FSM every VACUUM_FSM_EVERY_PAGES blocks. This condition was never met
due to the optimization, resulting in missed FSM vacuum
opportunities.

This commit modifies the periodic FSM vacuum condition to use the
number of tuples deleted during HOT pruning. This count includes items
marked as either LP_UNUSED or LP_REDIRECT, both of which are expected
to result in new free space to report.

Back-patch to v17 where the vacuum optimization for tables with no
indexes was introduced.

Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/CAD21AoBL8m6B9GSzQfYxVaEgvD7-Kr3AJaS-hJPHC+avm-29zw@mail.gmail.com
Backpatch-through: 17

Branch
------
REL_18_STABLE

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

Modified Files
--------------
src/backend/access/heap/vacuumlazy.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1uWqwZ-004JFX-11@gemulon.postgresql.org>
Permalink:  ../E1uWqwZ-004JFX-11@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uWqwZ-004JFX-11@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: msawada@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix missing FSM vacuum opportunities on tables without indexes.
  In-Reply-To: <E1uWqwZ-004JFX-11@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