~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/include/optimizer/cost.h

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*-------------------------------------------------------------------------
 
2
 *
 
3
 * cost.h
 
4
 *        prototypes for costsize.c and clausesel.c.
 
5
 *
 
6
 *
 
7
 * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
 
8
 * Portions Copyright (c) 1994, Regents of the University of California
 
9
 *
 
10
 * $PostgreSQL: pgsql/src/include/optimizer/cost.h,v 1.62 2004-12-31 22:03:36 pgsql Exp $
 
11
 *
 
12
 *-------------------------------------------------------------------------
 
13
 */
 
14
#ifndef COST_H
 
15
#define COST_H
 
16
 
 
17
#include "nodes/plannodes.h"
 
18
#include "nodes/relation.h"
 
19
 
 
20
 
 
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
 
29
 
 
30
 
 
31
/*
 
32
 * prototypes for costsize.c
 
33
 *        routines to compute costs and sizes
 
34
 */
 
35
 
 
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;
 
51
 
 
52
extern double clamp_row_est(double nrows);
 
53
extern void cost_seqscan(Path *path, Query *root,
 
54
                         RelOptInfo *baserel);
 
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,
 
62
                                  RelOptInfo *baserel);
 
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,
 
71
                 double input_tuples);
 
72
extern void cost_group(Path *path, Query *root,
 
73
                   int numGroupCols, double numGroups,
 
74
                   Cost input_startup_cost, Cost input_total_cost,
 
75
                   double input_tuples);
 
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,
 
84
                                                   JoinType jointype,
 
85
                                                   List *restrictlist);
 
86
extern void set_function_size_estimates(Query *root, RelOptInfo *rel);
 
87
 
 
88
/*
 
89
 * prototypes for clausesel.c
 
90
 *        routines to compute clause selectivities
 
91
 */
 
92
extern Selectivity clauselist_selectivity(Query *root,
 
93
                                           List *clauses,
 
94
                                           int varRelid,
 
95
                                           JoinType jointype);
 
96
extern Selectivity clause_selectivity(Query *root,
 
97
                                   Node *clause,
 
98
                                   int varRelid,
 
99
                                   JoinType jointype);
 
100
 
 
101
#endif   /* COST_H */