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
|
|
|
*
|
|
|
|
*
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
2000-06-09 00:38:00 +02:00
|
|
|
* $Id: cost.h,v 1.34 2000/06/08 22:37:51 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! */
|
|
|
|
#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
|
|
|
|
2000-02-15 21:49:31 +01:00
|
|
|
extern void cost_seqscan(Path *path, RelOptInfo *baserel);
|
|
|
|
extern void cost_index(Path *path, Query *root,
|
2000-04-12 19:17:23 +02:00
|
|
|
RelOptInfo *baserel, IndexOptInfo *index,
|
|
|
|
List *indexQuals, bool is_injoin);
|
2000-02-15 21:49:31 +01:00
|
|
|
extern void cost_tidscan(Path *path, RelOptInfo *baserel, List *tideval);
|
|
|
|
extern void cost_sort(Path *path, List *pathkeys, double tuples, int width);
|
|
|
|
extern void cost_nestloop(Path *path, Path *outer_path, Path *inner_path,
|
2000-04-12 19:17:23 +02:00
|
|
|
List *restrictlist);
|
2000-02-15 21:49:31 +01:00
|
|
|
extern void cost_mergejoin(Path *path, Path *outer_path, Path *inner_path,
|
2000-04-12 19:17:23 +02:00
|
|
|
List *restrictlist,
|
|
|
|
List *outersortkeys, List *innersortkeys);
|
2000-02-15 21:49:31 +01:00
|
|
|
extern void cost_hashjoin(Path *path, Path *outer_path, Path *inner_path,
|
2000-04-12 19:17:23 +02:00
|
|
|
List *restrictlist, Selectivity innerdisbursion);
|
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,
|
|
|
|
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);
|
1996-07-09 08:22:35 +02:00
|
|
|
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* COST_H */
|