Change planner to use the current true disk file size as its estimate of
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 1 Dec 2004 19:00:56 +0000 (19:00 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 1 Dec 2004 19:00:56 +0000 (19:00 +0000)
commit5374d097de4d7321f03df7899816e61502438b32
treee7dae5fe8181c528568b4a8bb9ca1aa4c7261831
parentb7bcea64ecca27e67dbc81525a71fcc0da396b36
Change planner to use the current true disk file size as its estimate of
a relation's number of blocks, rather than the possibly-obsolete value
in pg_class.relpages.  Scale the value in pg_class.reltuples correspondingly
to arrive at a hopefully more accurate number of rows.  When pg_class
contains 0/0, estimate a tuple width from the column datatypes and divide
that into current file size to estimate number of rows.  This improved
methodology allows us to jettison the ancient hacks that put bogus default
values into pg_class when a table is first created.  Also, per a suggestion
from Simon, make VACUUM (but not VACUUM FULL or ANALYZE) adjust the value
it puts into pg_class.reltuples to try to represent the mean tuple density
instead of the minimal density that actually prevails just after VACUUM.
These changes alter the plans selected for certain regression tests, so
update the expected files accordingly.  (I removed join_1.out because
it's not clear if it still applies; we can add back any variant versions
as they are shown to be needed.)
18 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/diskusage.sgml
doc/src/sgml/perform.sgml
doc/src/sgml/release.sgml
src/backend/access/nbtree/nbtree.c
src/backend/catalog/heap.c
src/backend/catalog/index.c
src/backend/commands/vacuum.c
src/backend/commands/vacuumlazy.c
src/backend/optimizer/util/plancat.c
src/backend/optimizer/util/relnode.c
src/include/access/genam.h
src/include/nodes/relation.h
src/test/regress/expected/case.out
src/test/regress/expected/inherit.out
src/test/regress/expected/join.out
src/test/regress/expected/join_1.out [deleted file]
src/test/regress/expected/polymorphism.out