1
/*-------------------------------------------------------------------------
4
* prototypes for costsize.c and clausesel.c.
7
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
8
* Portions Copyright (c) 1994, Regents of the University of California
10
* $PostgreSQL: pgsql/src/include/optimizer/cost.h,v 1.62 2004-12-31 22:03:36 pgsql Exp $
12
*-------------------------------------------------------------------------
17
#include "nodes/plannodes.h"
18
#include "nodes/relation.h"
21
/* defaults for costsize.c's Cost parameters */
22
/* NB: cost-estimation code should use the variables, not these constants! */
23
/* If you change these, update backend/utils/misc/postgresql.sample.conf */
24
#define DEFAULT_EFFECTIVE_CACHE_SIZE 1000.0 /* measured in pages */
25
#define DEFAULT_RANDOM_PAGE_COST 4.0
26
#define DEFAULT_CPU_TUPLE_COST 0.01
27
#define DEFAULT_CPU_INDEX_TUPLE_COST 0.001
28
#define DEFAULT_CPU_OPERATOR_COST 0.0025
32
* prototypes for costsize.c
33
* routines to compute costs and sizes
36
/* parameter variables and flags */
37
extern double effective_cache_size;
38
extern double random_page_cost;
39
extern double cpu_tuple_cost;
40
extern DLLIMPORT double cpu_index_tuple_cost;
41
extern double cpu_operator_cost;
42
extern Cost disable_cost;
43
extern bool enable_seqscan;
44
extern bool enable_indexscan;
45
extern bool enable_tidscan;
46
extern bool enable_sort;
47
extern bool enable_hashagg;
48
extern bool enable_nestloop;
49
extern bool enable_mergejoin;
50
extern bool enable_hashjoin;
52
extern double clamp_row_est(double nrows);
53
extern void cost_seqscan(Path *path, Query *root,
55
extern void cost_index(Path *path, Query *root,
56
RelOptInfo *baserel, IndexOptInfo *index,
57
List *indexQuals, bool is_injoin);
58
extern void cost_tidscan(Path *path, Query *root,
59
RelOptInfo *baserel, List *tideval);
60
extern void cost_subqueryscan(Path *path, RelOptInfo *baserel);
61
extern void cost_functionscan(Path *path, Query *root,
63
extern void cost_sort(Path *path, Query *root,
64
List *pathkeys, Cost input_cost, double tuples, int width);
65
extern void cost_material(Path *path,
66
Cost input_cost, double tuples, int width);
67
extern void cost_agg(Path *path, Query *root,
68
AggStrategy aggstrategy, int numAggs,
69
int numGroupCols, double numGroups,
70
Cost input_startup_cost, Cost input_total_cost,
72
extern void cost_group(Path *path, Query *root,
73
int numGroupCols, double numGroups,
74
Cost input_startup_cost, Cost input_total_cost,
76
extern void cost_nestloop(NestPath *path, Query *root);
77
extern void cost_mergejoin(MergePath *path, Query *root);
78
extern void cost_hashjoin(HashPath *path, Query *root);
79
extern void cost_qual_eval(QualCost *cost, List *quals);
80
extern void set_baserel_size_estimates(Query *root, RelOptInfo *rel);
81
extern void set_joinrel_size_estimates(Query *root, RelOptInfo *rel,
82
RelOptInfo *outer_rel,
83
RelOptInfo *inner_rel,
86
extern void set_function_size_estimates(Query *root, RelOptInfo *rel);
89
* prototypes for clausesel.c
90
* routines to compute clause selectivities
92
extern Selectivity clauselist_selectivity(Query *root,
96
extern Selectivity clause_selectivity(Query *root,