Re: relfilenode statistics

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: relfilenode statistics
Date: 2026-08-13 08:09:25
Message-ID: an17tXR24VxWE3w4@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Fri, Jul 10, 2026 at 03:05:35PM +0900, Michael Paquier wrote:
> - 0003

Thanks for sharing this! Now that the table/index split is (almost) in, let's
focus again on the relfilenode statistics.

> property that I do not wish to keep around is the aggregation of
> counters across rewrites, as the new counters don't make sense once we
> switch to a new relfilenode.

I think we should first agree on this point before looking further at 0003.
As written, the existing pg_stat_all_tables tuple related counters would be reset
by a rewrite.

The concern I see is how these statistics are currently used: relation_needs_vacanalyze()
uses dead_tuples, ins_since_vacuum, and mod_since_analyze for its three tuple based
vacuum or analyze decisions.

For example, a SET TABLESPACE move allocates a new relfilenumber but only copies
the relation’s storage. The previous counters are not transferred, so they are
read as zero for the new relfilenumber. A table that was eligible for vacuum or
analyze before the move may therefore no longer be eligible.

Do you agree that rewrites should not reset these counters?

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jakub Wartak 2026-08-13 08:27:51 enhancing pg_basebackup speeds up to ~23Gbps (small fixes + io_uring/Direct I/O)
Previous Message Fujii Masao 2026-08-13 07:45:32 Re: Correct some doc items due to the REPACK