diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2009-05-19 08:30:24 +0000 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2009-05-19 08:30:24 +0000 |
commit | 18b185cdf0aa478c49ddabcf1eb78dbb66ccb9c9 (patch) | |
tree | 4927d5a5e82020f984f67a8faa2cb77c2c73780e /src | |
parent | 5379bf74d79ba7a468923f46ee3b8fabde01afcd (diff) | |
download | postgresql-18b185cdf0aa478c49ddabcf1eb78dbb66ccb9c9.tar.gz postgresql-18b185cdf0aa478c49ddabcf1eb78dbb66ccb9c9.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.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/commands/analyze.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index d694600dc7b..04ac6b92c84 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.89.2.2 2008/01/03 21:24:26 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.89.2.3 2009/05/19 08:30:24 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -313,22 +313,10 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt) } /* - * Quit if no analyzable columns - */ - 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(RelationGetRelid(onerel), - onerel->rd_rel->relisshared, - 0, 0); - + * Quit if no analyzable columns and no pg_class update needed. + */ + if (attr_cnt <= 0 && !analyzableindex && vacstmt->vacuum) goto cleanup; - } /* * Determine how many rows we need to sample, using the worst case from |