Thread
-
[PATCH v1 11/12] prune_xid-hist: transfer data to shared histogram
Renan Alves Fonseca <renanfonseca@gmail.com> — 2025-05-20T11:46:01Z
--- src/backend/access/heap/vacuumlazy.c | 1 + src/backend/utils/activity/pgstat_relation.c | 5 ++++- src/include/pgstat.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index afd57e31f5b..a3698593156 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -940,6 +940,7 @@ heap_vacuum_rel(Relation rel, VacuumParams *params, Max(vacrel->new_live_tuples, 0), vacrel->recently_dead_tuples + vacrel->missed_dead_tuples, + &vacrel->prune_xid_hist, starttime); pgstat_progress_end_command(); diff --git a/src/backend/utils/activity/pgstat_relation.c b/src/backend/utils/activity/pgstat_relation.c index 06d97d3e0fb..ee49a2816e1 100644 --- a/src/backend/utils/activity/pgstat_relation.c +++ b/src/backend/utils/activity/pgstat_relation.c @@ -210,7 +210,7 @@ pgstat_drop_relation(Relation rel) void pgstat_report_vacuum(Oid tableoid, bool shared, PgStat_Counter livetuples, PgStat_Counter deadtuples, - TimestampTz starttime) + const PruneXidHistogramTransient *prune_xid_hist, TimestampTz starttime) { PgStat_EntryRef *entry_ref; PgStatShared_Relation *shtabentry; @@ -261,6 +261,8 @@ pgstat_report_vacuum(Oid tableoid, bool shared, tabentry->total_vacuum_time += elapsedtime; } + pgstat_update_shared_prune_xid_histogram(tabentry, prune_xid_hist); + pgstat_unlock_entry(entry_ref); /* @@ -1119,6 +1121,7 @@ pgstat_relation_flush_cb(PgStat_EntryRef *entry_ref, bool nowait) tabentry->live_tuples += lstats->counts.delta_live_tuples; tabentry->dead_tuples += lstats->counts.delta_dead_tuples; + pgstat_update_shared_prune_xid_histogram(tabentry, &lstats->counts.prune_xid_hist); tabentry->mod_since_analyze += lstats->counts.changed_tuples; /* diff --git a/src/include/pgstat.h b/src/include/pgstat.h index 698b42bf66b..2d577fefa28 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -679,7 +679,7 @@ extern void pgstat_unlink_relation(Relation rel); extern void pgstat_report_vacuum(Oid tableoid, bool shared, PgStat_Counter livetuples, PgStat_Counter deadtuples, - TimestampTz starttime); + const PruneXidHistogramTransient *prune_xid_hist, TimestampTz starttime); extern void pgstat_report_analyze(Relation rel, PgStat_Counter livetuples, PgStat_Counter deadtuples, bool resetcounter, TimestampTz starttime); -- 2.47.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=v1-0012-prune_xid-hist-tests.patch