diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2009-05-19 08:30:12 +0000 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2009-05-19 08:30:12 +0000 |
commit | 8e4862b42261e4037c2c3fd8fb62a779efd93b12 (patch) | |
tree | a49e60465071e6eb5c8448515b4ef44f8c6ce685 | |
parent | 9497c7a744dd8798359ed8db89c8ed6b41e9be76 (diff) | |
download | postgresql-8e4862b42261e4037c2c3fd8fb62a779efd93b12.tar.gz postgresql-8e4862b42261e4037c2c3fd8fb62a779efd93b12.zip |
Update relpages and reltuples estimates in stand-alone ANALYZE, even if
there's no analyzable attributes or indexes. We also used to report 0 live
and dead tuples for such tables, which messed with autovacuum threshold
calculations.
This fixes bug #4812 reported by George Su. Backpatch back to 8.1.
-rw-r--r-- | src/backend/commands/analyze.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 90f169b1022..e1e3498c7c6 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.114.2.1 2008/04/03 16:27:32 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.114.2.2 2009/05/19 08:30:12 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -341,19 +341,10 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt, } /* - * Quit if no analyzable columns + * Quit if no analyzable columns and no pg_class update needed. */ - if (attr_cnt <= 0 && !analyzableindex) - { - /* - * We report that the table is empty; this is just so that the - * autovacuum code doesn't go nuts trying to get stats about a - * zero-column table. - */ - if (!vacstmt->vacuum) - pgstat_report_analyze(onerel, 0, 0); + if (attr_cnt <= 0 && !analyzableindex && vacstmt->vacuum) goto cleanup; - } /* * Determine how many rows we need to sample, using the worst case from |