OSDN Git Service

New cost model for planning, incorporating a penalty for random page
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 15 Feb 2000 20:49:31 +0000 (20:49 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 15 Feb 2000 20:49:31 +0000 (20:49 +0000)
commitb1577a7c78d2d8880b3c0f94689fb75bd074c897
treec8d8f0500eb2eaa085d921a46a7d0987ba594a4a
parent553b5da6a1147881dc1df101ecf9bab75f767ccf
New cost model for planning, incorporating a penalty for random page
accesses versus sequential accesses, a (very crude) estimate of the
effects of caching on random page accesses, and cost to evaluate WHERE-
clause expressions.  Export critical parameters for this model as SET
variables.  Also, create SET variables for the planner's enable flags
(enable_seqscan, enable_indexscan, etc) so that these can be controlled
more conveniently than via PGOPTIONS.

Planner now estimates both startup cost (cost before retrieving
first tuple) and total cost of each path, so it can optimize queries
with LIMIT on a reasonable basis by interpolating between these costs.
Same facility is a win for EXISTS(...) subqueries and some other cases.

Redesign pathkey representation to achieve a major speedup in planning
(I saw as much as 5X on a 10-way join); also minor changes in planner
to reduce memory consumption by recycling discarded Path nodes and
not constructing unnecessary lists.

Minor cleanups to display more-plausible costs in some cases in
EXPLAIN output.

Initdb forced by change in interface to index cost estimation
functions.
50 files changed:
doc/src/sgml/libpq++.sgml
doc/src/sgml/libpq.sgml
doc/src/sgml/ref/set.sgml
doc/src/sgml/ref/show.sgml
src/backend/commands/explain.c
src/backend/commands/variable.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/freefuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/print.c
src/backend/nodes/readfuncs.c
src/backend/optimizer/README
src/backend/optimizer/geqo/geqo_eval.c
src/backend/optimizer/geqo/geqo_misc.c
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/joinpath.c
src/backend/optimizer/path/orindxpath.c
src/backend/optimizer/path/pathkeys.c
src/backend/optimizer/path/tidpath.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/planmain.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/subselect.c
src/backend/optimizer/prep/prepunion.c
src/backend/optimizer/util/pathnode.c
src/backend/optimizer/util/plancat.c
src/backend/optimizer/util/relnode.c
src/backend/utils/adt/selfuncs.c
src/bin/psql/tab-complete.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.h
src/include/nodes/nodes.h
src/include/nodes/parsenodes.h
src/include/nodes/plannodes.h
src/include/nodes/relation.h
src/include/optimizer/cost.h
src/include/optimizer/pathnode.h
src/include/optimizer/paths.h
src/include/optimizer/planmain.h
src/include/optimizer/planner.h
src/include/utils/builtins.h
src/interfaces/libpq/fe-connect.c
src/test/regress/expected/alter_table.out
src/test/regress/expected/select.out
src/test/regress/sql/alter_table.sql
src/test/regress/sql/select.sql