summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas2009-05-19 08:30:00 +0000
committerHeikki Linnakangas2009-05-19 08:30:00 +0000
commitbeb6141fa1933e409521c6ea0dbe9f50d1c54d15 (patch)
treec5d4044bfbec633cd62f09abf068bc3eab85c8c1
parenta2f4f39ae059f0bd677ba18eb7fe145dac98119f (diff)
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.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index cf6618b3ee..dbb4163d0f 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -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