diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2006-06-27 03:45:16 +0000 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2006-06-27 03:45:16 +0000 |
commit | 32ad0fc18311da9ec1f30f1444e3f97170e43e30 (patch) | |
tree | 70282ddcc77fa3baea0b4809e2bb063eeff53685 /src | |
parent | dc2c25fc6246866ce809a8b6bf1d2a2856334b54 (diff) | |
download | postgresql-32ad0fc18311da9ec1f30f1444e3f97170e43e30.tar.gz postgresql-32ad0fc18311da9ec1f30f1444e3f97170e43e30.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')
-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 a340a91fed2..f300b142dcc 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -13,7 +13,7 @@ * * Copyright (c) 2001-2006, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.130 2006/06/20 22:52:00 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.131 2006/06/27 03:45:16 alvherre Exp $ * ---------- */ #include "postgres.h" @@ -2635,7 +2635,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; @@ -2830,6 +2831,12 @@ pgstat_recv_vacuum(PgStat_MsgVacuum *msg, int len) else tabentry->analyze_timestamp = msg->m_vacuumtime; } + else + { + /* last_anl_tuples must never exceed n_live_tuples */ + tabentry->last_anl_tuples = Min(tabentry->last_anl_tuples, + msg->m_tuples); + } } /* ---------- |