mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
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.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pathnode.h,v 1.25 2000/02/07 04:41:04 tgl Exp $
|
||||
* $Id: pathnode.h,v 1.26 2000/02/15 20:49:26 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -19,15 +19,18 @@
|
||||
/*
|
||||
* prototypes for pathnode.c
|
||||
*/
|
||||
extern bool path_is_cheaper(Path *path1, Path *path2);
|
||||
extern Path *set_cheapest(RelOptInfo *parent_rel, List *pathlist);
|
||||
extern int compare_path_costs(Path *path1, Path *path2,
|
||||
CostSelector criterion);
|
||||
extern int compare_fractional_path_costs(Path *path1, Path *path2,
|
||||
double fraction);
|
||||
extern void set_cheapest(RelOptInfo *parent_rel);
|
||||
extern void add_path(RelOptInfo *parent_rel, Path *new_path);
|
||||
extern void add_pathlist(RelOptInfo *parent_rel, List *new_paths);
|
||||
|
||||
extern Path *create_seqscan_path(RelOptInfo *rel);
|
||||
extern IndexPath *create_index_path(Query *root, RelOptInfo *rel,
|
||||
IndexOptInfo *index,
|
||||
List *restriction_clauses);
|
||||
List *restriction_clauses,
|
||||
ScanDirection indexscandir);
|
||||
extern TidPath *create_tidscan_path(RelOptInfo *rel, List *tideval);
|
||||
|
||||
extern NestPath *create_nestloop_path(RelOptInfo *joinrel,
|
||||
|
||||
Reference in New Issue
Block a user