pgsql: Add pgstat test for reset of dead/live counters with table trunc

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add pgstat test for reset of dead/live counters with table trunc
Date: 2026-09-04 07:56:02
Message-ID: E1x2OmH-00000003QCI-1cra@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add pgstat test for reset of dead/live counters with table truncation

A patch has been proposed to refactor the table-level statistics to
treat the non-transactional and transactional parts as two separate
entities, in the scope of a larger piece of work to introduce
transactional flushes.

This commit adds a test for a pattern that has proved to be problematic
while splitting the relation stats data, and where we had no coverage
yet: an entry marked as truncdropped resets the live/dead counters in
the flush callback, leaving any other data intact. The code path
resetting the live/dead counters was covered, but nothing in the
regression tests checked the stats views for it.

Extracted from a larger patch by the same author.

Author: Sami Imseih <samimseih(dot)pg(at)gmail(dot)com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Discussion: https://postgr.es/m/aoU32VTkUtpdUewB@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ac00b0f8bdc59152e0d5b5f97c979595e9a5e2ad

Modified Files
--------------
src/test/regress/expected/stats.out | 27 +++++++++++++++++++++++++--
src/test/regress/sql/stats.sql | 16 +++++++++++++++-
2 files changed, 40 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Etsuro Fujita 2026-09-04 09:42:10 pgsql: postgres_fdw: Fix issues with statistics import.
Previous Message Michael Paquier 2026-09-04 07:03:51 pgsql: pg_upgrade: Skip tests for live server checks on Windows