aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2009-05-19 08:30:00 +0000
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2009-05-19 08:30:00 +0000
commit9ca99cda21a7eeb4bd975c811e7bcc6584255e1b (patch)
tree56c8a3dd17589c31d2f663e8f83461950423cc51
parent7280fab7173865f04b5cc635b0277501a18e6673 (diff)
downloadpostgresql-9ca99cda21a7eeb4bd975c811e7bcc6584255e1b.tar.gz
postgresql-9ca99cda21a7eeb4bd975c811e7bcc6584255e1b.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.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 6285a578889..5c5eb0444dd 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.136 2009/05/05 18:02:11 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.137 2009/05/19 08:30:00 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@@ -363,19 +363,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 (update_reltuples)
- pgstat_report_analyze(onerel, 0, 0);
+ if (attr_cnt <= 0 && !analyzableindex && !update_reltuples)
goto cleanup;
- }
/*
* Determine how many rows we need to sample, using the worst case from