1996-07-09 08:22:35 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* cost.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* prototypes for costsize.c and clausesel.c.
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*
|
2004-12-31 23:04:05 +01:00
|
|
|
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
2005-04-21 04:28:02 +02:00
|
|
|
* $PostgreSQL: pgsql/src/include/optimizer/cost.h,v 1.65 2005/04/21 02:28:02 tgl Exp $
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef COST_H
|
|
|
|
#define COST_H
|
|
|
|
|
2002-11-21 01:42:20 +01:00
|
|
|
#include "nodes/plannodes.h"
|
1997-11-26 02:14:33 +01:00
|
|
|
#include "nodes/relation.h"
|
|
|
|
|
2002-11-21 01:42:20 +01:00
|
|
|
|
2000-01-23 03:07:00 +01:00
|
|
|
/* defaults for costsize.c's Cost parameters */
|
2000-02-15 21:49:31 +01:00
|
|
|
/* NB: cost-estimation code should use the variables, not these constants! */
|
2001-01-24 19:37:31 +01:00
|
|
|
/* If you change these, update backend/utils/misc/postgresql.sample.conf */
|
2000-02-15 21:49:31 +01:00
|
|
|
#define DEFAULT_EFFECTIVE_CACHE_SIZE 1000.0 /* measured in pages */
|
|
|
|
#define DEFAULT_RANDOM_PAGE_COST 4.0
|
2000-04-12 19:17:23 +02:00
|
|
|
#define DEFAULT_CPU_TUPLE_COST 0.01
|
2000-02-15 21:49:31 +01:00
|
|
|
#define DEFAULT_CPU_INDEX_TUPLE_COST 0.001
|
|
|
|
#define DEFAULT_CPU_OPERATOR_COST 0.0025
|
2000-01-23 03:07:00 +01:00
|
|
|
|
1999-07-15 17:21:54 +02:00
|
|
|
|
1996-07-09 08:22:35 +02:00
|
|
|
/*
|
1999-02-14 00:22:53 +01:00
|
|
|
* prototypes for costsize.c
|
1997-09-07 07:04:48 +02:00
|
|
|
* routines to compute costs and sizes
|
|
|
|
*/
|
2000-01-23 00:50:30 +01:00
|
|
|
|
2000-02-15 21:49:31 +01:00
|
|
|
/* parameter variables and flags */
|
|
|
|
extern double effective_cache_size;
|
2000-05-31 02:28:42 +02:00
|
|
|
extern double random_page_cost;
|
|
|
|
extern double cpu_tuple_cost;
|
2003-06-11 17:01:15 +02:00
|
|
|
extern DLLIMPORT double cpu_index_tuple_cost;
|
2000-05-31 02:28:42 +02:00
|
|
|
extern double cpu_operator_cost;
|
2000-01-23 00:50:30 +01:00
|
|
|
extern Cost disable_cost;
|
|
|
|
extern bool enable_seqscan;
|
|
|
|
extern bool enable_indexscan;
|
|
|
|
extern bool enable_tidscan;
|
|
|
|
extern bool enable_sort;
|
2002-11-21 01:42:20 +01:00
|
|
|
extern bool enable_hashagg;
|
2000-01-23 00:50:30 +01:00
|
|
|
extern bool enable_nestloop;
|
|
|
|
extern bool enable_mergejoin;
|
|
|
|
extern bool enable_hashjoin;
|
1996-07-09 08:22:35 +02:00
|
|
|
|
2004-01-05 06:07:36 +01:00
|
|
|
extern double clamp_row_est(double nrows);
|
2005-03-27 08:29:49 +02:00
|
|
|
extern void cost_seqscan(Path *path, Query *root, RelOptInfo *baserel);
|
2005-04-21 04:28:02 +02:00
|
|
|
extern void cost_index(IndexPath *path, Query *root, IndexOptInfo *index,
|
2001-10-25 07:50:21 +02:00
|
|
|
List *indexQuals, bool is_injoin);
|
2005-04-20 00:35:18 +02:00
|
|
|
extern void cost_bitmap_scan(Path *path, Query *root, RelOptInfo *baserel,
|
|
|
|
Node *bitmapqual, bool is_injoin);
|
2001-06-05 07:26:05 +02:00
|
|
|
extern void cost_tidscan(Path *path, Query *root,
|
2001-10-25 07:50:21 +02:00
|
|
|
RelOptInfo *baserel, List *tideval);
|
2003-07-15 00:35:54 +02:00
|
|
|
extern void cost_subqueryscan(Path *path, RelOptInfo *baserel);
|
2002-05-12 22:10:05 +02:00
|
|
|
extern void cost_functionscan(Path *path, Query *root,
|
2002-09-04 22:31:48 +02:00
|
|
|
RelOptInfo *baserel);
|
2001-06-05 07:26:05 +02:00
|
|
|
extern void cost_sort(Path *path, Query *root,
|
2002-11-21 01:42:20 +01:00
|
|
|
List *pathkeys, Cost input_cost, double tuples, int width);
|
2002-11-30 06:21:03 +01:00
|
|
|
extern void cost_material(Path *path,
|
2003-08-04 02:43:34 +02:00
|
|
|
Cost input_cost, double tuples, int width);
|
2002-11-21 01:42:20 +01:00
|
|
|
extern void cost_agg(Path *path, Query *root,
|
2003-08-04 02:43:34 +02:00
|
|
|
AggStrategy aggstrategy, int numAggs,
|
|
|
|
int numGroupCols, double numGroups,
|
|
|
|
Cost input_startup_cost, Cost input_total_cost,
|
|
|
|
double input_tuples);
|
2002-11-21 01:42:20 +01:00
|
|
|
extern void cost_group(Path *path, Query *root,
|
2003-08-04 02:43:34 +02:00
|
|
|
int numGroupCols, double numGroups,
|
|
|
|
Cost input_startup_cost, Cost input_total_cost,
|
|
|
|
double input_tuples);
|
2003-01-27 21:51:54 +01:00
|
|
|
extern void cost_nestloop(NestPath *path, Query *root);
|
|
|
|
extern void cost_mergejoin(MergePath *path, Query *root);
|
|
|
|
extern void cost_hashjoin(HashPath *path, Query *root);
|
2003-08-08 23:42:59 +02:00
|
|
|
extern void cost_qual_eval(QualCost *cost, List *quals);
|
2000-02-07 05:41:04 +01:00
|
|
|
extern void set_baserel_size_estimates(Query *root, RelOptInfo *rel);
|
|
|
|
extern void set_joinrel_size_estimates(Query *root, RelOptInfo *rel,
|
2000-04-12 19:17:23 +02:00
|
|
|
RelOptInfo *outer_rel,
|
|
|
|
RelOptInfo *inner_rel,
|
2001-02-16 01:03:08 +01:00
|
|
|
JoinType jointype,
|
2000-04-12 19:17:23 +02:00
|
|
|
List *restrictlist);
|
2002-05-12 22:10:05 +02:00
|
|
|
extern void set_function_size_estimates(Query *root, RelOptInfo *rel);
|
1996-07-09 08:22:35 +02:00
|
|
|
|
|
|
|
/*
|
2000-01-09 01:26:47 +01:00
|
|
|
* prototypes for clausesel.c
|
1997-09-07 07:04:48 +02:00
|
|
|
* routines to compute clause selectivities
|
1996-07-09 08:22:35 +02:00
|
|
|
*/
|
2000-01-23 03:07:00 +01:00
|
|
|
extern Selectivity clauselist_selectivity(Query *root,
|
2003-08-04 02:43:34 +02:00
|
|
|
List *clauses,
|
|
|
|
int varRelid,
|
|
|
|
JoinType jointype);
|
2001-06-05 07:26:05 +02:00
|
|
|
extern Selectivity clause_selectivity(Query *root,
|
2003-08-04 02:43:34 +02:00
|
|
|
Node *clause,
|
|
|
|
int varRelid,
|
|
|
|
JoinType jointype);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* COST_H */
|