PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
planner.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * planner.h
4 * prototypes for planner.c.
5 *
6 * Note that the primary entry points for planner.c are declared in
7 * optimizer/optimizer.h, because they're intended to be called from
8 * non-planner code. Declarations here are meant for use by other
9 * planner modules.
10 *
11 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
12 * Portions Copyright (c) 1994, Regents of the University of California
13 *
14 * src/include/optimizer/planner.h
15 *
16 *-------------------------------------------------------------------------
17 */
18#ifndef PLANNER_H
19#define PLANNER_H
20
21#include "nodes/pathnodes.h"
22#include "nodes/plannodes.h"
23
24
25typedef struct ExplainState ExplainState; /* defined in explain_state.h */
26
27/* Hook for plugins to get control in planner() */
28typedef PlannedStmt *(*planner_hook_type) (Query *parse,
29 const char *query_string,
30 int cursorOptions,
31 ParamListInfo boundParams,
32 ExplainState *es);
34
35/* Hook for plugins to get control after PlannerGlobal is initialized */
37 const char *query_string,
38 double *tuple_fraction,
39 ExplainState *es);
41
42/* Hook for plugins to get control before PlannerGlobal is discarded */
44 const char *query_string,
47
48/* Hook for plugins to get control when grouping_planner() plans upper rels */
51 RelOptInfo *input_rel,
52 RelOptInfo *output_rel,
53 void *extra);
55
56
57extern PlannedStmt *standard_planner(Query *parse, const char *query_string,
58 int cursorOptions,
59 ParamListInfo boundParams,
60 ExplainState *es);
61
63 char *plan_name,
64 PlannerInfo *parent_root,
65 bool hasRecursion, double tuple_fraction,
66 SetOperationStmt *setops);
67
69 LockClauseStrength strength);
70
71extern bool limit_needed(Query *parse);
72
73extern void mark_partial_aggref(Aggref *agg, AggSplit aggsplit);
74
76 double tuple_fraction);
77
79
81 SpecialJoinInfo *sjinfo);
82
83extern char *choose_plan_name(PlannerGlobal *glob, const char *name,
84 bool always_number);
85
86#endif /* PLANNER_H */
#define PGDLLIMPORT
Definition: c.h:1323
LockClauseStrength
Definition: lockoptions.h:22
AggSplit
Definition: nodes.h:385
UpperRelationKind
Definition: pathnodes.h:70
PGDLLIMPORT planner_shutdown_hook_type planner_shutdown_hook
Definition: planner.c:80
char * choose_plan_name(PlannerGlobal *glob, const char *name, bool always_number)
Definition: planner.c:8961
void(* planner_setup_hook_type)(PlannerGlobal *glob, Query *parse, const char *query_string, double *tuple_fraction, ExplainState *es)
Definition: planner.h:36
RelOptInfo * create_unique_paths(PlannerInfo *root, RelOptInfo *rel, SpecialJoinInfo *sjinfo)
Definition: planner.c:8409
PlannerInfo * subquery_planner(PlannerGlobal *glob, Query *parse, char *plan_name, PlannerInfo *parent_root, bool hasRecursion, double tuple_fraction, SetOperationStmt *setops)
Definition: planner.c:693
Path * get_cheapest_fractional_path(RelOptInfo *rel, double tuple_fraction)
Definition: planner.c:6601
Expr * preprocess_phv_expression(PlannerInfo *root, Expr *expr)
Definition: planner.c:1431
RowMarkType select_rowmark_type(RangeTblEntry *rte, LockClauseStrength strength)
Definition: planner.c:2539
void mark_partial_aggref(Aggref *agg, AggSplit aggsplit)
Definition: planner.c:5762
PGDLLIMPORT planner_setup_hook_type planner_setup_hook
Definition: planner.c:77
PlannedStmt * standard_planner(Query *parse, const char *query_string, int cursorOptions, ParamListInfo boundParams, ExplainState *es)
Definition: planner.c:333
bool limit_needed(Query *parse)
Definition: planner.c:2790
PlannedStmt *(* planner_hook_type)(Query *parse, const char *query_string, int cursorOptions, ParamListInfo boundParams, ExplainState *es)
Definition: planner.h:28
PGDLLIMPORT create_upper_paths_hook_type create_upper_paths_hook
Definition: planner.c:83
PGDLLIMPORT planner_hook_type planner_hook
Definition: planner.c:74
void(* create_upper_paths_hook_type)(PlannerInfo *root, UpperRelationKind stage, RelOptInfo *input_rel, RelOptInfo *output_rel, void *extra)
Definition: planner.h:49
void(* planner_shutdown_hook_type)(PlannerGlobal *glob, Query *parse, const char *query_string, PlannedStmt *pstmt)
Definition: planner.h:43
RowMarkType
Definition: plannodes.h:1535
tree ctl root
Definition: radixtree.h:1857
static struct subre * parse(struct vars *v, int stopper, int type, struct state *init, struct state *final)
Definition: regcomp.c:717
PlannedStmt * pstmt
Definition: explain_state.h:64
const char * name