Ð ÐÐÐ, 29/11/2004 Ð 19:14 -0500, Tom Lane ÐÐÑÐÑ: > + /* > + * lazy_update_relstats - update pg_class statistics for a table or index > + * > + * We always want to set relpages to an accurate value. However, for lazy > + * VACUUM it seems best to set reltuples to the average of the number of > + * rows before vacuuming and the number after vacuuming, rather than just > + * using the number after vacuuming. This will result in the best average > + * performance in a steady-state situation where VACUUMs are performed > + * regularly on a table of roughly constant size, assuming that the physical > + * number of pages in the table stays about the same throughout. (Note that > + * we do not apply the same logic to VACUUM FULL, because it repacks the > table > + * and thereby boosts the tuple density.) > + */ > + static void > + lazy_update_relstats(Relation rel, BlockNumber num_pages, > + double num_tuples, double > tuples_removed, > + bool hasindex) > + { > + num_tuples = ceil(num_tuples + tuples_removed * 0.5);
Not understanding a thing about the PG source code, and judging from the variable names, wouldn't you want ceil(num_tuples + (num_tuples - tuples_removed) * 0.5) instead? > + vac_update_relstats(RelationGetRelid(rel), num_pages, num_tuples, > + hasindex); > } -- Markus Bertheau <[EMAIL PROTECTED]> ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org