summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2014-01-19 00:24:20 +0000
committerTom Lane2014-01-19 00:24:33 +0000
commit115f414124e71749d2d8f512e469ca63bc2166e5 (patch)
treeab361085d44a3491bc034041470a2fab1c644e92 /src/include
parent76e91b38ba64e1da70ea21744b342cb105ea3400 (diff)
Fix VACUUM's reporting of dead-tuple counts to the stats collector.
Historically, VACUUM has just reported its new_rel_tuples estimate (the same thing it puts into pg_class.reltuples) to the stats collector. That number counts both live and dead-but-not-yet-reclaimable tuples. This behavior may once have been right, but modern versions of the pgstats code track live and dead tuple counts separately, so putting the total into n_live_tuples and zero into n_dead_tuples is surely pretty bogus. Fix it to report live and dead tuple counts separately. This doesn't really do much for situations where updating transactions commit concurrently with a VACUUM scan (possibly causing double-counting or omission of the tuples they add or delete); but it's clearly an improvement over what we were doing before. Hari Babu, reviewed by Amit Kapila
Diffstat (limited to 'src/include')
-rw-r--r--src/include/pgstat.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 96ecc3aff65..0b458e59bb2 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -333,7 +333,8 @@ typedef struct PgStat_MsgVacuum
Oid m_tableoid;
bool m_autovacuum;
TimestampTz m_vacuumtime;
- PgStat_Counter m_tuples;
+ PgStat_Counter m_live_tuples;
+ PgStat_Counter m_dead_tuples;
} PgStat_MsgVacuum;
@@ -775,7 +776,7 @@ extern void pgstat_reset_single_counter(Oid objectid, PgStat_Single_Reset_Type t
extern void pgstat_report_autovac(Oid dboid);
extern void pgstat_report_vacuum(Oid tableoid, bool shared,
- PgStat_Counter tuples);
+ PgStat_Counter livetuples, PgStat_Counter deadtuples);
extern void pgstat_report_analyze(Relation rel,
PgStat_Counter livetuples, PgStat_Counter deadtuples);