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
17extern void pgpa_planner_install_hooks(void);
18
19/*
20 * Per-PlannerInfo information that we gather during query planning.
21 */
22typedef 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 */
38
39 /* Relation identifiers computed for baserels at this query level. */
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 */
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 */
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 */
78
79#endif
unsigned int Index
Definition c.h:698
void pgpa_planner_install_hooks(void)
int pgpa_planner_generate_advice
Definition pg_list.h:54
pgpa_identifier * rid_array
char * alternative_plan_name