cost.h 2.15 KB
Newer Older
1 2 3
/*-------------------------------------------------------------------------
 *
 * cost.h--
4
 *	  prototypes for costsize.c and clausesel.c.
5 6 7 8
 *
 *
 * Copyright (c) 1994, Regents of the University of California
 *
Bruce Momjian's avatar
Bruce Momjian committed
9
 * $Id: cost.h,v 1.6 1997/11/26 01:13:16 momjian Exp $
10 11 12 13 14 15
 *
 *-------------------------------------------------------------------------
 */
#ifndef COST_H
#define COST_H

Bruce Momjian's avatar
Bruce Momjian committed
16 17 18 19 20
#include "nodes/nodes.h"
#include "nodes/parsenodes.h"
#include "nodes/pg_list.h"
#include "nodes/relation.h"

21 22
/*
 * prototypes for costsize.c--
23 24
 *	  routines to compute costs and sizes
 */
25 26 27 28 29 30 31
extern bool _enable_seqscan_;
extern bool _enable_indexscan_;
extern bool _enable_sort_;
extern bool _enable_hash_;
extern bool _enable_nestloop_;
extern bool _enable_mergesort_;
extern bool _enable_hashjoin_;
32

33
extern Cost cost_seqscan(int relid, int relpages, int reltuples);
34
extern Cost
35 36 37
cost_index(Oid indexid, int expected_indexpages, Cost selec,
		   int relpages, int reltuples, int indexpages,
		   int indextuples, bool is_injoin);
38 39
extern Cost cost_sort(List *keys, int tuples, int width, bool noread);
extern Cost
40 41
cost_nestloop(Cost outercost, Cost innercost, int outertuples,
			  int innertuples, int outerpages, bool is_indexjoin);
42
extern Cost
43
cost_mergesort(Cost outercost, Cost innercost,
44
			   List *outersortkeys, List *innersortkeys,
45
		   int outersize, int innersize, int outerwidth, int innerwidth);
46 47 48
extern Cost
cost_hashjoin(Cost outercost, Cost innercost, List *outerkeys,
			  List *innerkeys, int outersize, int innersize,
49
			  int outerwidth, int innerwidth);
50 51 52
extern int	compute_rel_size(Rel *rel);
extern int	compute_rel_width(Rel *rel);
extern int	compute_joinrel_size(JoinPath *joinpath);
53
extern int	page_size(int tuples, int width);
54 55 56

/*
 * prototypes for fuctions in clausesel.h--
57
 *	  routines to compute clause selectivities
58
 */
59 60 61 62 63 64 65
extern void set_clause_selectivities(List *clauseinfo_list, Cost new_selectivity);
extern Cost product_selec(List *clauseinfo_list);
extern void set_rest_relselec(Query *root, List *rel_list);
extern void set_rest_selec(Query *root, List *clauseinfo_list);
extern Cost
compute_clause_selec(Query *root,
					 Node *clause, List *or_selectivities);
66

67
#endif							/* COST_H */