|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* pathnode.h
|
|
|
|
* prototypes for pathnode.c, relnode.c.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
|
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
|
|
|
* src/include/optimizer/pathnode.h
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef PATHNODE_H
|
|
|
|
#define PATHNODE_H
|
|
|
|
|
|
|
|
#include "nodes/relation.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* prototypes for pathnode.c
|
|
|
|
*/
|
|
|
|
extern int compare_path_costs(Path *path1, Path *path2,
|
|
|
|
CostSelector criterion);
|
|
|
|
extern int compare_fractional_path_costs(Path *path1, Path *path2,
|
|
|
|
double fraction);
|
|
|
|
extern void set_cheapest(RelOptInfo *parent_rel);
|
|
|
|
extern void add_path(RelOptInfo *parent_rel, Path *new_path);
|
|
|
|
|
|
|
|
extern Path *create_seqscan_path(PlannerInfo *root, RelOptInfo *rel);
|
|
|
|
extern IndexPath *create_index_path(PlannerInfo *root,
|
|
|
|
IndexOptInfo *index,
|
|
|
|
List *indexclauses,
|
|
|
|
List *indexclausecols,
|
|
|
|
List *indexorderbys,
|
|
|
|
List *indexorderbycols,
|
|
|
|
List *pathkeys,
|
|
|
|
ScanDirection indexscandir,
|
|
|
|
bool indexonly,
|
|
|
|
RelOptInfo *outer_rel);
|
|
|
|
extern BitmapHeapPath *create_bitmap_heap_path(PlannerInfo *root,
|
|
|
|
RelOptInfo *rel,
|
|
|
|
Path *bitmapqual,
|
|
|
|
RelOptInfo *outer_rel);
|
|
|
|
extern BitmapAndPath *create_bitmap_and_path(PlannerInfo *root,
|
|
|
|
RelOptInfo *rel,
|
|
|
|
List *bitmapquals);
|
|
|
|
extern BitmapOrPath *create_bitmap_or_path(PlannerInfo *root,
|
|
|
|
RelOptInfo *rel,
|
|
|
|
List *bitmapquals);
|
|
|
|
extern TidPath *create_tidscan_path(PlannerInfo *root, RelOptInfo *rel,
|
|
|
|
List *tidquals);
|
|
|
|
extern AppendPath *create_append_path(RelOptInfo *rel, List *subpaths);
|
|
|
|
extern MergeAppendPath *create_merge_append_path(PlannerInfo *root,
|
|
|
|
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.
19 years ago
|
|
|
extern ResultPath *create_result_path(List *quals);
|
|
|
|
extern MaterialPath *create_material_path(RelOptInfo *rel, Path *subpath);
|
|
|
|
extern UniquePath *create_unique_path(PlannerInfo *root, RelOptInfo *rel,
|
|
|
|
Path *subpath, SpecialJoinInfo *sjinfo);
|
|
|
|
extern Path *create_subqueryscan_path(RelOptInfo *rel, List *pathkeys);
|
|
|
|
extern Path *create_functionscan_path(PlannerInfo *root, RelOptInfo *rel);
|
|
|
|
extern Path *create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel);
|
|
|
|
extern Path *create_ctescan_path(PlannerInfo *root, RelOptInfo *rel);
|
|
|
|
extern Path *create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel);
|
|
|
|
extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel);
|
|
|
|
|
|
|
|
extern NestPath *create_nestloop_path(PlannerInfo *root,
|
|
|
|
RelOptInfo *joinrel,
|
|
|
|
JoinType jointype,
|
|
|
|
SpecialJoinInfo *sjinfo,
|
|
|
|
Path *outer_path,
|
|
|
|
Path *inner_path,
|
|
|
|
List *restrict_clauses,
|
|
|
|
List *pathkeys);
|
|
|
|
|
|
|
|
extern MergePath *create_mergejoin_path(PlannerInfo *root,
|
|
|
|
RelOptInfo *joinrel,
|
|
|
|
JoinType jointype,
|
|
|
|
SpecialJoinInfo *sjinfo,
|
|
|
|
Path *outer_path,
|
|
|
|
Path *inner_path,
|
|
|
|
List *restrict_clauses,
|
|
|
|
List *pathkeys,
|
|
|
|
List *mergeclauses,
|
|
|
|
List *outersortkeys,
|
|
|
|
List *innersortkeys);
|
|
|
|
|
|
|
|
extern HashPath *create_hashjoin_path(PlannerInfo *root,
|
|
|
|
RelOptInfo *joinrel,
|
|
|
|
JoinType jointype,
|
|
|
|
SpecialJoinInfo *sjinfo,
|
|
|
|
Path *outer_path,
|
|
|
|
Path *inner_path,
|
|
|
|
List *restrict_clauses,
|
|
|
|
List *hashclauses);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* prototypes for relnode.c
|
|
|
|
*/
|
|
|
|
extern void setup_simple_rel_arrays(PlannerInfo *root);
|
|
|
|
extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
|
|
|
|
RelOptKind reloptkind);
|
|
|
|
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,
|
|
|
|
Relids joinrelids,
|
|
|
|
RelOptInfo *outer_rel,
|
|
|
|
RelOptInfo *inner_rel,
|
|
|
|
SpecialJoinInfo *sjinfo,
|
|
|
|
List **restrictlist_ptr);
|
|
|
|
|
|
|
|
#endif /* PATHNODE_H */
|