postgresql/src/include
Tom Lane b4b6923e03 Fix VACUUM so that it always updates pg_class.reltuples/relpages.
When we added the ability for vacuum to skip heap pages by consulting the
visibility map, we made it just not update the reltuples/relpages
statistics if it skipped any pages.  But this could leave us with extremely
out-of-date stats for a table that contains any unchanging areas,
especially for TOAST tables which never get processed by ANALYZE.  In
particular this could result in autovacuum making poor decisions about when
to process the table, as in recent report from Florian Helmberger.  And in
general it's a bad idea to not update the stats at all.  Instead, use the
previous values of reltuples/relpages as an estimate of the tuple density
in unvisited pages.  This approach results in a "moving average" estimate
of reltuples, which should converge to the correct value over multiple
VACUUM and ANALYZE cycles even when individual measurements aren't very
good.

This new method for updating reltuples is used by both VACUUM and ANALYZE,
with the result that we no longer need the grotty interconnections that
caused ANALYZE to not update the stats depending on what had happened
in the parent VACUUM command.

Also, fix the logic for skipping all-visible pages during VACUUM so that it
looks ahead rather than behind to decide what to do, as per a suggestion
from Greg Stark.  This eliminates useless scanning of all-visible pages at
the start of the relation or just after a not-all-visible page.  In
particular, the first few pages of the relation will not be invariably
included in the scanned pages, which seems to help in not overweighting
them in the reltuples estimate.

Back-patch to 8.4, where the visibility map was introduced.
2011-05-30 17:06:52 -04:00
..
access Make GIN and GIST pass the index collation to all their support functions. 2011-04-22 20:13:12 -04:00
bootstrap Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
catalog Improve hash_array() logic for combining hash values. 2011-05-23 15:17:18 -04:00
commands Fix VACUUM so that it always updates pg_class.reltuples/relpages. 2011-05-30 17:06:52 -04:00
executor Install defenses against overflow in BuildTupleHashTable(). 2011-05-23 12:52:46 -04:00
foreign pgindent run before PG 9.1 beta 1. 2011-04-10 11:42:00 -04:00
lib Use a macro variable PG_PRINTF_ATTRIBUTE for the style used for checking printf type functions. 2011-04-28 10:56:14 -04:00
libpq pgindent run before PG 9.1 beta 1. 2011-04-10 11:42:00 -04:00
mb Fix char2wchar/wchar2char to support collations properly. 2011-04-23 12:35:41 -04:00
nodes Pull up isReset flag from AllocSetContext to MemoryContext struct. This 2011-05-21 14:47:19 -04:00
optimizer Improve cost estimation for aggregates and window functions. 2011-04-24 16:55:20 -04:00
parser Fix handling of collations in multi-row VALUES constructs. 2011-04-18 15:31:52 -04:00
port Revert "Force use of "%I64d" format for 64 bit ints on MinGW." 2011-04-27 14:55:18 -04:00
portability Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
postmaster Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
regex Teach regular expression operators to honor collations. 2011-04-10 18:03:09 -04:00
replication pgindent run before PG 9.1 beta 1. 2011-04-10 11:42:00 -04:00
rewrite pgindent run before PG 9.1 beta 1. 2011-04-10 11:42:00 -04:00
snowball Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
storage The row-version chaining in Serializable Snapshot Isolation was still wrong. 2011-05-30 20:47:17 +03:00
tcop Revise the API for GUC variable assign hooks. 2011-04-07 00:12:02 -04:00
tsearch pgindent run before PG 9.1 beta 1. 2011-04-10 11:42:00 -04:00
utils Split PGC_S_DEFAULT into two values, for true boot_val vs computed default. 2011-05-11 19:57:38 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
c.h Use a macro variable PG_PRINTF_ATTRIBUTE for the style used for checking printf type functions. 2011-04-28 10:56:14 -04:00
fmgr.h Pass collations to functions in FunctionCallInfoData, not FmgrInfo. 2011-04-12 19:19:24 -04:00
funcapi.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
getaddrinfo.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
getopt_long.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
Makefile Add maintainer-check target 2011-03-28 22:56:52 +03:00
miscadmin.h Add postmaster/postgres undocumented -b option for binary upgrades. 2011-04-25 12:00:21 -04:00
pg_config.h.in Fix char2wchar/wchar2char to support collations properly. 2011-04-23 12:35:41 -04:00
pg_config.h.win32 Tag 9.1beta1. 2011-04-27 17:17:22 -04:00
pg_config_manual.h Use a macro variable PG_PRINTF_ATTRIBUTE for the style used for checking printf type functions. 2011-04-28 10:56:14 -04:00
pg_trace.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
pgstat.h Fix VACUUM so that it always updates pg_class.reltuples/relpages. 2011-05-30 17:06:52 -04:00
pgtime.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
port.h Use a macro variable PG_PRINTF_ATTRIBUTE for the style used for checking printf type functions. 2011-04-28 10:56:14 -04:00
postgres.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
postgres_ext.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
postgres_fe.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
rusagestub.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
windowapi.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00