| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Split transaction data out of pgstats table counters |
| Date: | 2026-09-10 04:56:46 |
| Message-ID: | E1x4Wq5-00000004EhQ-0EsC@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Split transaction data out of pgstats table counters
At backend level, PgStat_TableCounts currently stores all the per-table
pending counters in one structure. This is now split into two parts,
with the transactional part of the data moved out of PgStat_TableCounts
into its own structure labelled with an "xact" in PgStat_RelationStatus.
While on it, move truncdropped out of the counters and into
PgStat_RelationStatus so as both structs (existing PgStat_TableCounts
and new PgStat_TableCountsXact) contain only counters. The previous
state was slightly confusing: this flag is a state tracking if a
relation has been truncated at backend-level, and not a counter.
Because truncdropped no longer lives inside PgStat_TableCounts, this
commit teaches the flush callback to treat a pending truncate as
sufficient reason to flush, even when both counter structs are otherwise
all zeros.
This refactoring work is in preparation of a different patch that wants
to introduce the concept of transactional stats data flush. Compared to
all the other stats kinds, relations are an exception as they mix
transactional and non-transactional data.
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/3f2f5e7c4cc5a917e77a3d5a0c4353b702aa7307
Modified Files
--------------
src/backend/utils/activity/pgstat_relation.c | 108 ++++++++++++++-------------
src/backend/utils/adt/pgstatfuncs.c | 24 +++---
src/include/pgstat.h | 42 ++++++++---
src/tools/pgindent/typedefs.list | 1 +
4 files changed, 104 insertions(+), 71 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Langote | 2026-09-10 05:46:01 | pgsql: Remove batching from RI fast-path checks |
| Previous Message | Amit Langote | 2026-09-10 04:35:07 | pgsql: Take RI fast-path snapshot after locking referenced relation |