PostgreSQL Source Code
git master
Loading...
Searching...
No Matches
pgpa_planner.h
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
*
3
* pgpa_planner.h
4
* planner integration for pg_plan_advice
5
*
6
* Copyright (c) 2016-2026, PostgreSQL Global Development Group
7
*
8
* contrib/pg_plan_advice/pgpa_planner.h
9
*
10
*-------------------------------------------------------------------------
11
*/
12
#ifndef PGPA_PLANNER_H
13
#define PGPA_PLANNER_H
14
15
#include "
pgpa_identifier.h
"
16
17
extern
void
pgpa_planner_install_hooks
(
void
);
18
19
/*
20
* Per-PlannerInfo information that we gather during query planning.
21
*/
22
typedef
struct
pgpa_planner_info
23
{
24
/* Plan name taken from the corresponding PlannerInfo; NULL at top level. */
25
char
*
plan_name
;
26
27
/*
28
* If the corresponding PlannerInfo has an alternative_root, then this is
29
* the plan name from that PlannerInfo; otherwise, it is the same as
30
* plan_name.
31
*
32
* is_alternative_plan is set to true for every pgpa_planner_info that
33
* shares an alternative_plan_name with at least one other, and to false
34
* otherwise.
35
*/
36
char
*
alternative_plan_name
;
37
bool
is_alternative_plan
;
38
39
/* Relation identifiers computed for baserels at this query level. */
40
pgpa_identifier
*
rid_array
;
41
int
rid_array_size
;
42
43
/*
44
* If has_rtoffset is true, then rtoffset is the offset required to align
45
* RTIs for this query level with RTIs from the final, flattened
46
* rangetable. If has_rtoffset is false, then this subquery's range table
47
* wasn't copied, or was only partially copied, into the final range
48
* table. (Note that we can't determine the rtoffset values until the
49
* final range table actually exists; before that time, has_rtoffset will
50
* be false everywhere except at the top level.)
51
*/
52
bool
has_rtoffset
;
53
Index
rtoffset
;
54
55
/*
56
* List of Bitmapset objects. Each represents the relid set of a relation
57
* that the planner considers making unique during semijoin planning.
58
*
59
* When generating advice, we should emit either SEMIJOIN_UNIQUE advice or
60
* SEMIJOIN_NON_UNIQUE advice for each semijoin depending on whether we
61
* chose to implement it as a semijoin or whether we instead chose to make
62
* the nullable side unique and then perform an inner join. When the
63
* make-unique strategy is not chosen, it's not easy to tell from the
64
* final plan tree whether it was considered. That's awkward, because we
65
* don't want to emit useless SEMIJOIN_NON_UNIQUE advice when there was no
66
* decision to be made. This list lets the plan tree walker know in which
67
* cases that approach was considered, so that it doesn't have to guess.
68
*/
69
List
*
sj_unique_rels
;
70
}
pgpa_planner_info
;
71
72
/*
73
* When set to a value greater than zero, indicates that advice should be
74
* generated during query planning even in the absence of obvious reasons to
75
* do so. See pg_plan_advice_request_advice_generation().
76
*/
77
extern
int
pgpa_planner_generate_advice
;
78
79
#endif
Index
unsigned int Index
Definition
c.h:698
pgpa_identifier.h
pgpa_planner_install_hooks
void pgpa_planner_install_hooks(void)
Definition
pgpa_planner.c:182
pgpa_planner_generate_advice
int pgpa_planner_generate_advice
Definition
pgpa_planner.c:97
List
Definition
pg_list.h:54
pgpa_identifier
Definition
pgpa_identifier.h:20
pgpa_planner_info
Definition
pgpa_planner.h:23
pgpa_planner_info::rid_array
pgpa_identifier * rid_array
Definition
pgpa_planner.h:40
pgpa_planner_info::is_alternative_plan
bool is_alternative_plan
Definition
pgpa_planner.h:37
pgpa_planner_info::sj_unique_rels
List * sj_unique_rels
Definition
pgpa_planner.h:69
pgpa_planner_info::alternative_plan_name
char * alternative_plan_name
Definition
pgpa_planner.h:36
pgpa_planner_info::has_rtoffset
bool has_rtoffset
Definition
pgpa_planner.h:52
pgpa_planner_info::plan_name
char * plan_name
Definition
pgpa_planner.h:25
pgpa_planner_info::rtoffset
Index rtoffset
Definition
pgpa_planner.h:53
pgpa_planner_info::rid_array_size
int rid_array_size
Definition
pgpa_planner.h:41
contrib
pg_plan_advice
pgpa_planner.h
Generated on Fri Apr 3 2026 04:13:09 for PostgreSQL Source Code by
1.9.8