1996-07-09 02:22:35 -04:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
*
|
1999-02-13 18:22:53 -05:00
|
|
|
* pathnode.h
|
2000-09-29 14:21:41 -04:00
|
|
|
* prototypes for pathnode.c, relnode.c.
|
1996-07-09 02:22:35 -04:00
|
|
|
*
|
|
|
|
|
*
|
2012-01-01 18:01:58 -05:00
|
|
|
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
|
2000-01-26 00:58:53 -05:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-07-09 02:22:35 -04:00
|
|
|
*
|
2010-09-20 16:08:53 -04:00
|
|
|
* src/include/optimizer/pathnode.h
|
1996-07-09 02:22:35 -04:00
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
#ifndef PATHNODE_H
|
|
|
|
|
#define PATHNODE_H
|
|
|
|
|
|
1997-11-25 20:14:33 -05:00
|
|
|
#include "nodes/relation.h"
|
|
|
|
|
|
2003-02-08 15:20:55 -05:00
|
|
|
|
1996-07-09 02:22:35 -04:00
|
|
|
/*
|
|
|
|
|
* prototypes for pathnode.c
|
|
|
|
|
*/
|
2000-02-15 15:49:31 -05:00
|
|
|
extern int compare_path_costs(Path *path1, Path *path2,
|
2000-04-12 13:17:23 -04:00
|
|
|
CostSelector criterion);
|
2000-02-15 15:49:31 -05:00
|
|
|
extern int compare_fractional_path_costs(Path *path1, Path *path2,
|
2000-04-12 13:17:23 -04:00
|
|
|
double fraction);
|
2000-02-15 15:49:31 -05:00
|
|
|
extern void set_cheapest(RelOptInfo *parent_rel);
|
2000-02-06 23:41:04 -05:00
|
|
|
extern void add_path(RelOptInfo *parent_rel, Path *new_path);
|
2012-01-27 19:26:38 -05:00
|
|
|
extern bool add_path_precheck(RelOptInfo *parent_rel,
|
|
|
|
|
Cost startup_cost, Cost total_cost,
|
|
|
|
|
List *pathkeys, Relids required_outer);
|
1999-08-15 22:17:58 -04:00
|
|
|
|
2005-06-05 18:32:58 -04:00
|
|
|
extern Path *create_seqscan_path(PlannerInfo *root, RelOptInfo *rel);
|
|
|
|
|
extern IndexPath *create_index_path(PlannerInfo *root,
|
2000-04-12 13:17:23 -04:00
|
|
|
IndexOptInfo *index,
|
2011-12-24 19:03:21 -05:00
|
|
|
List *indexclauses,
|
|
|
|
|
List *indexclausecols,
|
2010-12-02 20:50:48 -05:00
|
|
|
List *indexorderbys,
|
2011-12-24 19:03:21 -05:00
|
|
|
List *indexorderbycols,
|
2000-12-14 17:30:45 -05:00
|
|
|
List *pathkeys,
|
2005-04-22 17:58:32 -04:00
|
|
|
ScanDirection indexscandir,
|
2011-10-07 20:13:02 -04:00
|
|
|
bool indexonly,
|
2012-01-27 19:26:38 -05:00
|
|
|
Relids required_outer,
|
|
|
|
|
double loop_count);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern BitmapHeapPath *create_bitmap_heap_path(PlannerInfo *root,
|
2005-10-14 22:49:52 -04:00
|
|
|
RelOptInfo *rel,
|
|
|
|
|
Path *bitmapqual,
|
2012-01-27 19:26:38 -05:00
|
|
|
double loop_count);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern BitmapAndPath *create_bitmap_and_path(PlannerInfo *root,
|
2005-10-14 22:49:52 -04:00
|
|
|
RelOptInfo *rel,
|
|
|
|
|
List *bitmapquals);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern BitmapOrPath *create_bitmap_or_path(PlannerInfo *root,
|
2005-10-14 22:49:52 -04:00
|
|
|
RelOptInfo *rel,
|
|
|
|
|
List *bitmapquals);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern TidPath *create_tidscan_path(PlannerInfo *root, RelOptInfo *rel,
|
2005-11-26 17:14:57 -05:00
|
|
|
List *tidquals);
|
2000-11-11 19:37:02 -05:00
|
|
|
extern AppendPath *create_append_path(RelOptInfo *rel, List *subpaths);
|
2010-10-14 16:56:39 -04:00
|
|
|
extern MergeAppendPath *create_merge_append_path(PlannerInfo *root,
|
2011-04-10 11:42:00 -04:00
|
|
|
RelOptInfo *rel,
|
|
|
|
|
List *subpaths,
|
|
|
|
|
List *pathkeys);
|
Revise the planner's handling of "pseudoconstant" WHERE clauses, that is
clauses containing no variables and no volatile functions. Such a clause
can be used as a one-time qual in a gating Result plan node, to suppress
plan execution entirely when it is false. Even when the clause is true,
putting it in a gating node wins by avoiding repeated evaluation of the
clause. In previous PG releases, query_planner() would do this for
pseudoconstant clauses appearing at the top level of the jointree, but
there was no ability to generate a gating Result deeper in the plan tree.
To fix it, get rid of the special case in query_planner(), and instead
process pseudoconstant clauses through the normal RestrictInfo qual
distribution mechanism. When a pseudoconstant clause is found attached to
a path node in create_plan(), pull it out and generate a gating Result at
that point. This requires special-casing pseudoconstants in selectivity
estimation and cost_qual_eval, but on the whole it's pretty clean.
It probably even makes the planner a bit faster than before for the normal
case of no pseudoconstants, since removing pull_constant_clauses saves one
useless traversal of the qual tree. Per gripe from Phil Frost.
2006-07-01 14:38:33 -04:00
|
|
|
extern ResultPath *create_result_path(List *quals);
|
2002-11-30 00:21:03 -05:00
|
|
|
extern MaterialPath *create_material_path(RelOptInfo *rel, Path *subpath);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern UniquePath *create_unique_path(PlannerInfo *root, RelOptInfo *rel,
|
2008-08-14 14:48:00 -04:00
|
|
|
Path *subpath, SpecialJoinInfo *sjinfo);
|
2003-02-15 15:12:41 -05:00
|
|
|
extern Path *create_subqueryscan_path(RelOptInfo *rel, List *pathkeys);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern Path *create_functionscan_path(PlannerInfo *root, RelOptInfo *rel);
|
2006-08-01 21:59:48 -04:00
|
|
|
extern Path *create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel);
|
2008-10-04 17:56:55 -04:00
|
|
|
extern Path *create_ctescan_path(PlannerInfo *root, RelOptInfo *rel);
|
|
|
|
|
extern Path *create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel);
|
2012-03-05 16:15:59 -05:00
|
|
|
extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
|
|
|
|
|
double rows, Cost startup_cost, Cost total_cost,
|
|
|
|
|
List *pathkeys,
|
|
|
|
|
Relids required_outer, List *param_clauses,
|
|
|
|
|
List *fdw_private);
|
1999-08-15 22:17:58 -04:00
|
|
|
|
2012-01-27 19:26:38 -05:00
|
|
|
extern Relids calc_nestloop_required_outer(Path *outer_path, Path *inner_path);
|
|
|
|
|
extern Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path);
|
|
|
|
|
|
2005-06-05 18:32:58 -04:00
|
|
|
extern NestPath *create_nestloop_path(PlannerInfo *root,
|
2001-10-25 01:50:21 -04:00
|
|
|
RelOptInfo *joinrel,
|
|
|
|
|
JoinType jointype,
|
2012-01-27 19:26:38 -05:00
|
|
|
JoinCostWorkspace *workspace,
|
2008-08-14 14:48:00 -04:00
|
|
|
SpecialJoinInfo *sjinfo,
|
2012-01-27 19:26:38 -05:00
|
|
|
SemiAntiJoinFactors *semifactors,
|
2001-10-25 01:50:21 -04:00
|
|
|
Path *outer_path,
|
|
|
|
|
Path *inner_path,
|
|
|
|
|
List *restrict_clauses,
|
2012-01-27 19:26:38 -05:00
|
|
|
List *pathkeys,
|
|
|
|
|
Relids required_outer);
|
2000-01-08 19:26:47 -05:00
|
|
|
|
2005-06-05 18:32:58 -04:00
|
|
|
extern MergePath *create_mergejoin_path(PlannerInfo *root,
|
2001-10-25 01:50:21 -04:00
|
|
|
RelOptInfo *joinrel,
|
|
|
|
|
JoinType jointype,
|
2012-01-27 19:26:38 -05:00
|
|
|
JoinCostWorkspace *workspace,
|
2008-08-14 14:48:00 -04:00
|
|
|
SpecialJoinInfo *sjinfo,
|
2001-10-25 01:50:21 -04:00
|
|
|
Path *outer_path,
|
|
|
|
|
Path *inner_path,
|
|
|
|
|
List *restrict_clauses,
|
|
|
|
|
List *pathkeys,
|
2012-01-27 19:26:38 -05:00
|
|
|
Relids required_outer,
|
2001-10-25 01:50:21 -04:00
|
|
|
List *mergeclauses,
|
|
|
|
|
List *outersortkeys,
|
|
|
|
|
List *innersortkeys);
|
2000-01-08 19:26:47 -05:00
|
|
|
|
2005-06-05 18:32:58 -04:00
|
|
|
extern HashPath *create_hashjoin_path(PlannerInfo *root,
|
2001-10-25 01:50:21 -04:00
|
|
|
RelOptInfo *joinrel,
|
|
|
|
|
JoinType jointype,
|
2012-01-27 19:26:38 -05:00
|
|
|
JoinCostWorkspace *workspace,
|
2008-08-14 14:48:00 -04:00
|
|
|
SpecialJoinInfo *sjinfo,
|
2012-01-27 19:26:38 -05:00
|
|
|
SemiAntiJoinFactors *semifactors,
|
2001-10-25 01:50:21 -04:00
|
|
|
Path *outer_path,
|
|
|
|
|
Path *inner_path,
|
|
|
|
|
List *restrict_clauses,
|
2012-01-27 19:26:38 -05:00
|
|
|
Relids required_outer,
|
2001-10-25 01:50:21 -04:00
|
|
|
List *hashclauses);
|
1996-07-09 02:22:35 -04:00
|
|
|
|
|
|
|
|
/*
|
2000-02-06 23:41:04 -05:00
|
|
|
* prototypes for relnode.c
|
1996-07-09 02:22:35 -04:00
|
|
|
*/
|
2011-09-03 15:35:12 -04:00
|
|
|
extern void setup_simple_rel_arrays(PlannerInfo *root);
|
2006-01-31 16:39:25 -05:00
|
|
|
extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
|
2006-10-03 20:30:14 -04:00
|
|
|
RelOptKind reloptkind);
|
2005-06-05 18:32:58 -04:00
|
|
|
extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid);
|
|
|
|
|
extern RelOptInfo *find_join_rel(PlannerInfo *root, Relids relids);
|
|
|
|
|
extern RelOptInfo *build_join_rel(PlannerInfo *root,
|
2003-08-03 20:43:34 -04:00
|
|
|
Relids joinrelids,
|
|
|
|
|
RelOptInfo *outer_rel,
|
|
|
|
|
RelOptInfo *inner_rel,
|
2008-08-14 14:48:00 -04:00
|
|
|
SpecialJoinInfo *sjinfo,
|
2003-08-03 20:43:34 -04:00
|
|
|
List **restrictlist_ptr);
|
2001-10-28 01:26:15 -05:00
|
|
|
|
2001-11-05 12:46:40 -05:00
|
|
|
#endif /* PATHNODE_H */
|