aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2006-02-11 17:14:09 +0000
committerBruce Momjian <bruce@momjian.us>2006-02-11 17:14:09 +0000
commit77bb65d3fcdd2b588cec4b94af05e3d3f30e80cc (patch)
tree36929633459fe21c8eae3a03bfcdb1e1e5a6511d /src/backend/commands
parentbf324946b32736da1b128b1e742515879b42a4e8 (diff)
downloadpostgresql-77bb65d3fcdd2b588cec4b94af05e3d3f30e80cc.tar.gz
postgresql-77bb65d3fcdd2b588cec4b94af05e3d3f30e80cc.zip
Revert based on Tom's recommendation:
> Allow VACUUM to complete faster by avoiding scanning the indexes when no > rows were removed from the heap by the VACUUM.
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/vacuum.c14
-rw-r--r--src/backend/commands/vacuumlazy.c11
2 files changed, 9 insertions, 16 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 4e7775a6cda..d60c433095d 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.322 2006/02/11 16:59:09 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.323 2006/02/11 17:14:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -719,8 +719,7 @@ vac_update_relstats(Oid relid, BlockNumber num_pages, double num_tuples,
/* overwrite the existing statistics in the tuple */
pgcform = (Form_pg_class) GETSTRUCT(&rtup);
pgcform->relpages = (int32) num_pages;
- if (num_tuples >= 0 )
- pgcform->reltuples = (float4) num_tuples;
+ pgcform->reltuples = (float4) num_tuples;
pgcform->relhasindex = hasindex;
/*
@@ -2962,18 +2961,15 @@ scan_index(Relation indrel, double num_tuples)
if (!stats)
return;
- /* now update statistics in pg_class
- * we use the number of tuples from the table because we have not
- * actually scanned the index, so don't know the number of tuples in index
- */
+ /* now update statistics in pg_class */
vac_update_relstats(RelationGetRelid(indrel),
- stats->num_pages, num_tuples,
+ stats->num_pages, stats->num_index_tuples,
false);
ereport(elevel,
(errmsg("index \"%s\" now contains %.0f row versions in %u pages",
RelationGetRelationName(indrel),
- num_tuples,
+ stats->num_index_tuples,
stats->num_pages),
errdetail("%u index pages have been deleted, %u are currently reusable.\n"
"%s.",
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index 0b2789da485..a65c269fc8c 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -31,7 +31,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.64 2006/02/11 16:59:09 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.65 2006/02/11 17:14:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -639,19 +639,16 @@ lazy_scan_index(Relation indrel, LVRelStats *vacrelstats)
if (!stats)
return;
- /* now update statistics in pg_class
- * we use the number of tuples from the table because we have not
- * actually scanned the index, so don't know the number of tuples in index
- */
+ /* now update statistics in pg_class */
vac_update_relstats(RelationGetRelid(indrel),
stats->num_pages,
- vacrelstats->rel_tuples,
+ stats->num_index_tuples,
false);
ereport(elevel,
(errmsg("index \"%s\" now contains %.0f row versions in %u pages",
RelationGetRelationName(indrel),
- vacrelstats->rel_tuples,
+ stats->num_index_tuples,
stats->num_pages),
errdetail("%u index pages have been deleted, %u are currently reusable.\n"
"%s.",