Move increase FSM warning to after lazy_truncate_heap() because the
function might reduce the number of free pages in the table. Recommend VACUUM FULL only if 20% free. Simon Riggs.
This commit is contained in:
parent
6f519ad01c
commit
3aa37600aa
|
@ -36,7 +36,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 */
|
/* Update shared free space map with final free space info */
|
||||||
lazy_update_fsm(onerel, vacrelstats);
|
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 */
|
/* Update statistics in pg_class */
|
||||||
vac_update_relstats(RelationGetRelid(onerel),
|
vac_update_relstats(RelationGetRelid(onerel),
|
||||||
vacrelstats->rel_pages,
|
vacrelstats->rel_pages,
|
||||||
|
@ -507,13 +517,6 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
|
||||||
vacrelstats->tot_free_pages,
|
vacrelstats->tot_free_pages,
|
||||||
empty_pages,
|
empty_pages,
|
||||||
pg_rusage_show(&ru0))));
|
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\".")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue