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
|
|
|
*
|
|
|
|
*
|
2001-01-24 20:43:33 +01:00
|
|
|
* Portions Copyright (c) 1996-2001, 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
|
|
|
*
|
2001-10-28 07:26:15 +01:00
|
|
|
* $Id: cost.h,v 1.42 2001/10/28 06:26:07 momjian Exp $
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef COST_H
|
|
|
|
#define COST_H
|
|
|
|
|
1997-11-26 02:14:33 +01:00
|
|
|
#include "nodes/relation.h"
|
|
|
|
|
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
|
|
|
/* defaults for function attributes used for expensive function calculations */
|
|
|
|
#define BYTE_PCT 100
|
|
|
|
#define PERBYTE_CPU 0
|
|
|
|
#define PERCALL_CPU 0
|
|
|
|
#define OUTIN_RATIO 100
|
2000-01-23 00:50:30 +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;
|
|
|
|
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);
|
2001-06-05 07:26:05 +02:00
|
|
|
extern void cost_sort(Path *path, Query *root,
|
2001-10-25 07:50:21 +02:00
|
|
|
List *pathkeys, double tuples, int width);
|
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);
|
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
|
|
|
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* COST_H */
|