Re: repack with verbose output: not showing the number of removable row versions when using USING INDEX or CONCURRENTLY option

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Jochen Bandhauer <jb(at)jbitc(dot)de>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: repack with verbose output: not showing the number of removable row versions when using USING INDEX or CONCURRENTLY option
Date: 2026-11-24 18:41:49
Message-ID: awXV8-8pH-cYAFUs@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2026-Aug-26, Jochen Bandhauer wrote:

> I have taken a closer look at this today and I found that the "removable"
> count was probably influenced by page pruning in my original bug report.
> This can also be seen with the cluster command in v18. I would propose to
> add these lines to the Notes section of the cluster and repack command
> documentation:
>
> The number of removable row versions shown in the verbose output should not
> be considered a definitive measure of all dead tuples in the table. It
> reflects the number of dead tuples encountered by the specific scanning
> method (e.g., an index scan) that was used to rebuild the table. In some
> cases, dead tuples may be physically removed from the heap (pruned) before
> they are even encountered, further influencing this count.

Hmm, I'm not sure that we should emit any output that we know is
potentially misleading, and then have docs to explain that. If we keep
track of things, then we report those things; if we didn't, then I think
we shouldn't report anything. Then we don't need to document awkward
inaccuracies.

Maybe Srinath's patch, attached for convenience, does approximately that?

=# repack (verbose,concurrently) t;
INFO: repacking "public.t" in physical order
INFO: "public.t": copied 100000 row versions in 448 pages
DETAIL: CPU: user: 0.04 s, system: 0.00 s, elapsed: 0.04 s.
REPACK

(I wonder if we should report the number of pages in the original table
to compare with the pages of the rewritten table, to point out how
effective the repacking really was; which is what the "found N
removable row versions" bit was saying.)

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/

Attachment Content-Type Size
0001-Rework-REPACK-message.patch text/x-diff 2.0 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message Tom Lane 2026-11-24 18:01:58 Re: BUG #19932: `repack (concurrently)` does not work in `psql` with `AUTOCOMMIT` set to `off`