1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-27 00:12:01 +03:00

Revise handling of index-type-specific indexscan cost estimation, per

pghackers discussion of 5-Jan-2000.  The amopselect and amopnpages
estimators are gone, and in their place is a per-AM amcostestimate
procedure (linked to from pg_am, not pg_amop).
This commit is contained in:
Tom Lane
2000-01-22 23:50:30 +00:00
parent 78845177bb
commit 71ed7eb494
30 changed files with 502 additions and 1113 deletions

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: cost.h,v 1.25 2000/01/09 00:26:46 tgl Exp $
* $Id: cost.h,v 1.26 2000/01/22 23:50:26 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,23 +20,31 @@
#define PERBYTE_CPU 0
#define PERCALL_CPU 0
#define OUTIN_RATIO 100
/* defaults for costsize.c's Cost parameters */
/* NB: cost-estimation code should use the variables, not the constants! */
#define CPU_PAGE_WEIGHT 0.033
#define CPU_INDEX_PAGE_WEIGHT 0.017
/*
* prototypes for costsize.c
* routines to compute costs and sizes
*/
extern bool _enable_seqscan_;
extern bool _enable_indexscan_;
extern bool _enable_sort_;
extern bool _enable_nestloop_;
extern bool _enable_mergejoin_;
extern bool _enable_hashjoin_;
extern bool _enable_tidscan_;
extern Cost cpu_page_weight;
extern Cost cpu_index_page_weight;
extern Cost disable_cost;
extern bool enable_seqscan;
extern bool enable_indexscan;
extern bool enable_tidscan;
extern bool enable_sort;
extern bool enable_nestloop;
extern bool enable_mergejoin;
extern bool enable_hashjoin;
extern Cost cost_seqscan(RelOptInfo *baserel);
extern Cost cost_index(RelOptInfo *baserel, IndexOptInfo *index,
long expected_indexpages, Selectivity selec,
bool is_injoin);
extern Cost cost_index(Query *root, RelOptInfo *baserel, IndexOptInfo *index,
List *indexQuals, bool is_injoin);
extern Cost cost_tidscan(RelOptInfo *baserel, List *tideval);
extern Cost cost_sort(List *pathkeys, double tuples, int width);
extern Cost cost_nestloop(Path *outer_path, Path *inner_path,

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: internal.h,v 1.24 2000/01/11 03:59:31 tgl Exp $
* $Id: internal.h,v 1.25 2000/01/22 23:50:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,14 +25,6 @@
*/
/*
* System-dependent tuning constants
*
*/
#define _CPU_PAGE_WEIGHT_ 0.033 /* CPU-heap-to-page cost weighting factor */
#define _CPU_INDEX_PAGE_WEIGHT_ 0.017 /* CPU-index-to-page cost
* weighting factor */
/*
* Size estimates
*
@@ -60,7 +52,4 @@
/* used to be -1 */
#define _NONAME_RELATION_ID_ InvalidOid
/* GEQO switch according to number of relations in a query */
#define GEQO_RELS 11
#endif /* INTERNAL_H */

View File

@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: paths.h,v 1.37 2000/01/09 00:26:47 tgl Exp $
* $Id: paths.h,v 1.38 2000/01/22 23:50:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,9 +16,16 @@
#include "nodes/relation.h"
/* default GEQO threshold (default value for geqo_rels) */
#define GEQO_RELS 11
/*
* allpaths.c
*/
extern bool enable_geqo;
extern int geqo_rels;
extern RelOptInfo *make_one_rel(Query *root, List *rels);
/*

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: plancat.h,v 1.15 2000/01/09 00:26:47 tgl Exp $
* $Id: plancat.h,v 1.16 2000/01/22 23:50:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,10 +30,6 @@ extern Selectivity restriction_selectivity(Oid functionObjectId,
Datum constValue,
int constFlag);
extern void index_selectivity(Query *root, RelOptInfo *rel,
IndexOptInfo *index, List *indexquals,
long *idxPages, Selectivity *idxSelec);
extern Selectivity join_selectivity(Oid functionObjectId, Oid operatorObjectId,
Oid relationObjectId1, AttrNumber attributeNumber1,
Oid relationObjectId2, AttrNumber attributeNumber2);