diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2006-06-27 03:45:28 +0000 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2006-06-27 03:45:28 +0000 |
commit | 4ca74397b4f6faa6038384470337482e1c591e94 (patch) | |
tree | 4a33f545a4d562423116a25708903013a01404d0 /src/backend | |
parent | cc6dbbeefcd1af31775f52ed23f8d0f34f932e2e (diff) | |
download | postgresql-4ca74397b4f6faa6038384470337482e1c591e94.tar.gz postgresql-4ca74397b4f6faa6038384470337482e1c591e94.zip |
Clamp last_anl_tuples to n_live_tuples, in case we vacuum a table without
analyzing, so that future analyze threshold calculations don't get confused.
Also, make sure we correctly track the decrease of live tuples cause by
deletes.
Per report from Dylan Hansen, patches by Tom Lane and me.
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/postmaster/pgstat.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index cd3c4b28cbf..29087c15385 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -13,7 +13,7 @@ * * Copyright (c) 2001-2005, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.111.2.3 2006/05/19 15:15:38 alvherre Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.111.2.4 2006/06/27 03:45:28 alvherre Exp $ * ---------- */ #include "postgres.h" @@ -2919,6 +2919,12 @@ pgstat_recv_vacuum(PgStat_MsgVacuum *msg, int len) tabentry->n_dead_tuples = 0; if (msg->m_analyze) tabentry->last_anl_tuples = msg->m_tuples; + else + { + /* last_anl_tuples must never exceed n_live_tuples */ + tabentry->last_anl_tuplse = Min(tabentry->last_anl_tuples, + msg->m_tuples); + } } /* ---------- @@ -3055,7 +3061,8 @@ pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len) tabentry->tuples_updated += tabmsg[i].t_tuples_updated; tabentry->tuples_deleted += tabmsg[i].t_tuples_deleted; - tabentry->n_live_tuples += tabmsg[i].t_tuples_inserted; + tabentry->n_live_tuples += tabmsg[i].t_tuples_inserted - + tabmsg[i].t_tuples_deleted; tabentry->n_dead_tuples += tabmsg[i].t_tuples_updated + tabmsg[i].t_tuples_deleted; |