summaryrefslogtreecommitdiff
path: root/src/backend/commands/analyze.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/analyze.c')
-rw-r--r--src/backend/commands/analyze.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 0739db99f50..aa41cd3d4c4 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.144 2009/12/29 20:11:44 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.145 2009/12/30 20:32:14 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -535,16 +535,13 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt,
}
/*
- * Update pages/tuples stats in pg_class.
+ * Update pages/tuples stats in pg_class, but not if we're inside a
+ * VACUUM that got a more precise number.
*/
if (update_reltuples)
- {
vac_update_relstats(onerel,
RelationGetNumberOfBlocks(onerel),
totalrows, hasindex, InvalidTransactionId);
- /* report results to the stats collector, too */
- pgstat_report_analyze(onerel, totalrows, totaldeadrows);
- }
/*
* Same for indexes. Vacuum always scans all indexes, so if we're part of
@@ -565,6 +562,13 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt,
}
}
+ /*
+ * Report ANALYZE to the stats collector, too; likewise, tell it to
+ * adopt these numbers only if we're not inside a VACUUM that got a
+ * better number.
+ */
+ pgstat_report_analyze(onerel, update_reltuples, totalrows, totaldeadrows);
+
/* We skip to here if there were no analyzable columns */
cleanup: