Rewrite of planner statistics-gathering code. ANALYZE is now available as

Tom Lane <tgl@sss.pgh.pa.us>

Commit: f905d65ee35b3f84b6d4433a5198af0e2e7bd090
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2001-05-07T00:43:27Z
Releases: 7.2.1
Rewrite of planner statistics-gathering code.  ANALYZE is now available as
a separate statement (though it can still be invoked as part of VACUUM, too).
pg_statistic redesigned to be more flexible about what statistics are
stored.  ANALYZE now collects a list of several of the most common values,
not just one, plus a histogram (not just the min and max values).  Random
sampling is used to make the process reasonably fast even on very large
tables.  The number of values and histogram bins collected is now
user-settable via an ALTER TABLE command.

There is more still to do; the new stats are not being used everywhere
they could be in the planner.  But the remaining changes for this project
should be localized, and the behavior is already better than before.

A not-very-related change is that sorting now makes use of btree comparison
routines if it can find one, rather than invoking '<' twice.

Files

PathChange+/−
doc/src/sgml/catalogs.sgml modified +154 −29
doc/src/sgml/indices.sgml modified +2 −2
doc/src/sgml/ref/allfiles.sgml modified +2 −1
doc/src/sgml/ref/alter_table.sgml modified +17 −9
doc/src/sgml/ref/analyze.sgml added +219 −0
doc/src/sgml/reference.sgml modified +2 −1
doc/src/sgml/ref/vacuum.sgml modified +23 −26
doc/src/sgml/xoper.sgml modified +2 −2
src/backend/access/common/tupdesc.c modified +9 −9
src/backend/access/gist/gist.c modified +8 −8
src/backend/access/hash/hash.c modified +6 −6
src/backend/access/heap/tuptoaster.c modified +38 −1
src/backend/access/nbtree/nbtree.c modified +6 −6
src/backend/access/rtree/rtree.c modified +6 −6
src/backend/catalog/genbki.sh modified +5 −2
src/backend/catalog/heap.c modified +66 −59
src/backend/catalog/index.c modified +24 −58
src/backend/commands/analyze.c modified +1426 −454
src/backend/commands/command.c modified +111 −17
src/backend/commands/vacuum.c modified +138 −103
src/backend/executor/nodeSort.c modified +35 −44
src/backend/nodes/copyfuncs.c modified +6 −5
src/backend/nodes/equalfuncs.c modified +6 −4
src/backend/nodes/readfuncs.c modified +4 −4
src/backend/optimizer/path/costsize.c modified +180 −13
src/backend/optimizer/path/joinpath.c modified +16 −42
src/backend/optimizer/plan/createplan.c modified +5 −5
src/backend/optimizer/plan/initsplan.c modified +5 −4
src/backend/optimizer/plan/planner.c modified +3 −3
src/backend/optimizer/prep/prepunion.c modified +3 −3
src/backend/optimizer/util/pathnode.c modified +6 −6
src/backend/optimizer/util/plancat.c modified +1 −2
src/backend/parser/analyze.c modified +2 −2
src/backend/parser/gram.y modified +109 −82
src/backend/parser/keywords.c modified +2 −1
src/backend/parser/parse_relation.c modified +3 −17
src/backend/tcop/utility.c modified +18 −11
src/backend/utils/adt/selfuncs.c modified +530 −393
src/backend/utils/cache/lsyscache.c modified +158 −101
src/backend/utils/cache/syscache.c modified +2 −2
src/backend/utils/sort/tuplesort.c modified +208 −25
src/include/access/tuptoaster.h modified +8 −4
src/include/catalog/catversion.h modified +2 −2
src/include/catalog/heap.h modified +4 −1
src/include/catalog/index.h modified +2 −2
src/include/catalog/indexing.h modified +2 −2
src/include/catalog/pg_attribute.h modified +122 −132
src/include/catalog/pg_class.h modified +2 −2
src/include/catalog/pg_statistic.h modified +146 −31
src/include/commands/command.h modified +8 −4
src/include/commands/vacuum.h modified +9 −111
src/include/config.h.in modified +6 −1
src/include/nodes/execnodes.h modified +1 −3
src/include/nodes/parsenodes.h modified +13 −8
src/include/nodes/primnodes.h modified +4 −4
src/include/nodes/relation.h modified +3 −3
src/include/optimizer/cost.h modified +3 −2
src/include/optimizer/pathnode.h modified +2 −2
src/include/utils/lsyscache.h modified +9 −3
src/include/utils/syscache.h modified +2 −2
src/include/utils/tuplesort.h modified +19 −3
src/interfaces/ecpg/preproc/keywords.c modified +2 −1
src/interfaces/ecpg/preproc/preproc.y modified +58 −58
src/test/regress/expected/oidjoins.out modified +21 −5
src/test/regress/expected/opr_sanity.out modified +2 −2
src/test/regress/sql/oidjoins.sql modified +11 −3