]> granicus.if.org Git - postgresql/commitdiff
Move increase FSM warning to after lazy_truncate_heap() because the
authorBruce Momjian <bruce@momjian.us>
Wed, 21 Feb 2007 22:15:21 +0000 (22:15 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 21 Feb 2007 22:15:21 +0000 (22:15 +0000)
function might reduce the number of free pages in the table.  Recommend
VACUUM FULL only if 20% free.

Simon Riggs.

src/backend/commands/vacuumlazy.c

index 676d5687893e59a5984f83770b78ea426b18200c..b892ea19ab377b67bebfb26ac05727645c935663 100644 (file)
@@ -36,7 +36,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.83 2007/02/04 03:10:55 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.84 2007/02/21 22:15:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -180,6 +180,16 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt)
        /* Update shared free space map with final free space info */
        lazy_update_fsm(onerel, vacrelstats);
 
+       if (vacrelstats->tot_free_pages > MaxFSMPages)
+               ereport(WARNING,
+                               (errmsg("relation \"%s.%s\" contains more than \"max_fsm_pages\" pages with useful free space",
+                                               get_namespace_name(RelationGetNamespace(onerel)),
+                                               RelationGetRelationName(onerel)),
+                                errhint("Consider%sincreasing the configuration parameter \"max_fsm_pages\".",
+                                               /* Only suggest VACUUM FULL if 20% free */
+                                               (vacrelstats->tot_free_pages > vacrelstats->rel_pages * 0.20
+                                                       ? " using VACUUM FULL on this relation or ": " "))));
+
        /* Update statistics in pg_class */
        vac_update_relstats(RelationGetRelid(onerel),
                                                vacrelstats->rel_pages,
@@ -507,13 +517,6 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
                                           vacrelstats->tot_free_pages,
                                           empty_pages,
                                           pg_rusage_show(&ru0))));
-
-       if (vacrelstats->tot_free_pages > MaxFSMPages)
-               ereport(WARNING,
-                               (errmsg("relation \"%s.%s\" contains more than \"max_fsm_pages\" pages with useful free space",
-                                               get_namespace_name(RelationGetNamespace(onerel)),
-                                               relname),
-                                errhint("Consider using VACUUM FULL on this relation or increasing the configuration parameter \"max_fsm_pages\".")));
 }