1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-06 00:02:13 +03:00

Add vacuum and analyze counters to pg_stat_*_tables views.

This commit is contained in:
Magnus Hagander
2010-08-21 10:59:17 +00:00
parent efe2e9a758
commit 946045f04d
7 changed files with 147 additions and 15 deletions

View File

@@ -13,7 +13,7 @@
*
* Copyright (c) 2001-2010, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.205 2010/08/08 16:27:03 tgl Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.206 2010/08/21 10:59:17 mha Exp $
* ----------
*/
#include "postgres.h"
@@ -3192,6 +3192,10 @@ pgstat_get_tab_entry(PgStat_StatDBEntry *dbentry, Oid tableoid, bool create)
result->autovac_vacuum_timestamp = 0;
result->analyze_timestamp = 0;
result->autovac_analyze_timestamp = 0;
result->vacuum_count = 0;
result->autovac_vacuum_count = 0;
result->analyze_count = 0;
result->autovac_analyze_count = 0;
}
return result;
@@ -4114,9 +4118,15 @@ pgstat_recv_vacuum(PgStat_MsgVacuum *msg, int len)
tabentry->n_dead_tuples = 0;
if (msg->m_autovacuum)
{
tabentry->autovac_vacuum_timestamp = msg->m_vacuumtime;
tabentry->autovac_vacuum_count++;
}
else
{
tabentry->vacuum_timestamp = msg->m_vacuumtime;
tabentry->vacuum_count++;
}
}
/* ----------
@@ -4151,9 +4161,15 @@ pgstat_recv_analyze(PgStat_MsgAnalyze *msg, int len)
tabentry->changes_since_analyze = 0;
if (msg->m_autovacuum)
{
tabentry->autovac_analyze_timestamp = msg->m_analyzetime;
tabentry->autovac_analyze_count++;
}
else
{
tabentry->analyze_timestamp = msg->m_analyzetime;
tabentry->analyze_count++;
}
}