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
|
|
|
*
|
|
|
|
*
|
2002-06-20 22:29:54 +02:00
|
|
|
* Portions Copyright (c) 1996-2002, 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
|
|
|
*
|
2002-11-30 06:21:03 +01:00
|
|
|
* $Id: cost.h,v 1.49 2002/11/30 05:21:03 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;
|
|
|
|
extern double cpu_index_tuple_cost;
|
|
|
|
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
|
|
|
|
2001-06-05 07:26:05 +02:00
|
|
|
extern void cost_seqscan(Path *path, Query *root,
|
2001-10-25 07:50:21 +02:00
|
|
|
RelOptInfo *baserel);
|
2000-02-15 21:49:31 +01:00
|
|
|
extern void cost_index(Path *path, Query *root,
|
2001-10-25 07:50:21 +02:00
|
|
|
RelOptInfo *baserel, IndexOptInfo *index,
|
|
|
|
List *indexQuals, 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);
|
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,
|
|
|
|
Cost input_cost, double tuples, int width);
|
2002-11-21 01:42:20 +01:00
|
|
|
extern void cost_agg(Path *path, Query *root,
|
|
|
|
AggStrategy aggstrategy, int numAggs,
|
|
|
|
int numGroupCols, double numGroups,
|
|
|
|
Cost input_startup_cost, Cost input_total_cost,
|
|
|
|
double input_tuples);
|
|
|
|
extern void cost_group(Path *path, Query *root,
|
|
|
|
int numGroupCols, double numGroups,
|
|
|
|
Cost input_startup_cost, Cost input_total_cost,
|
|
|
|
double input_tuples);
|
2001-06-05 07:26:05 +02:00
|
|
|
extern void cost_nestloop(Path *path, Query *root,
|
2001-10-25 07:50:21 +02:00
|
|
|
Path *outer_path, Path *inner_path,
|
|
|
|
List *restrictlist);
|
2001-06-05 07:26:05 +02:00
|
|
|
extern void cost_mergejoin(Path *path, Query *root,
|
2001-10-25 07:50:21 +02:00
|
|
|
Path *outer_path, Path *inner_path,
|
|
|
|
List *restrictlist,
|
|
|
|
List *mergeclauses,
|
|
|
|
List *outersortkeys, List *innersortkeys);
|
2001-06-05 07:26:05 +02:00
|
|
|
extern void cost_hashjoin(Path *path, Query *root,
|
2001-10-25 07:50:21 +02:00
|
|
|
Path *outer_path, Path *inner_path,
|
|
|
|
List *restrictlist,
|
|
|
|
List *hashclauses);
|
2000-02-15 21:49:31 +01:00
|
|
|
extern Cost cost_qual_eval(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 restrictlist_selectivity(Query *root,
|
2000-04-12 19:17:23 +02:00
|
|
|
List *restrictinfo_list,
|
|
|
|
int varRelid);
|
2000-01-23 03:07:00 +01:00
|
|
|
extern Selectivity clauselist_selectivity(Query *root,
|
2000-04-12 19:17:23 +02:00
|
|
|
List *clauses,
|
|
|
|
int varRelid);
|
2001-06-05 07:26:05 +02:00
|
|
|
extern Selectivity clause_selectivity(Query *root,
|
2001-10-25 07:50:21 +02:00
|
|
|
Node *clause,
|
|
|
|
int varRelid);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* COST_H */
|