postgres.git / summary / log / commit / refs
commit 6432580fdbecd41d8d29998b99a8bf2567f171d1
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Tue May 19 08:30:18 2009 +0000
First released in: 8.4.0, 8.1.18, 8.2.14, 8.3.8
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.
src/backend/commands/analyze.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 233345c1c47..8a76782f13a 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.101.2.1 2008/01/03 21:23:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.101.2.2 2009/05/19 08:30:18 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@@ -314,22 +314,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
[parent: 1b72c707029b]