PostgreSQL Source Code
git master
Loading...
Searching...
No Matches
pgpa_trove.h
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
*
3
* pgpa_trove.h
4
* All of the advice given for a particular query, appropriately
5
* organized for convenient access.
6
*
7
* Copyright (c) 2016-2026, PostgreSQL Global Development Group
8
*
9
* contrib/pg_plan_advice/pgpa_trove.h
10
*
11
*-------------------------------------------------------------------------
12
*/
13
#ifndef PGPA_TROVE_H
14
#define PGPA_TROVE_H
15
16
#include "
pgpa_ast.h
"
17
18
#include "
nodes/bitmapset.h
"
19
20
typedef
struct
pgpa_trove
pgpa_trove
;
21
22
/*
23
* Each entry in a trove of advice represents the application of a tag to
24
* a single target.
25
*/
26
typedef
struct
pgpa_trove_entry
27
{
28
pgpa_advice_tag_type
tag
;
29
pgpa_advice_target
*
target
;
30
int
flags
;
31
}
pgpa_trove_entry
;
32
33
/*
34
* What kind of information does the caller want to find in a trove?
35
*
36
* PGPA_TROVE_LOOKUP_SCAN means we're looking for scan advice.
37
*
38
* PGPA_TROVE_LOOKUP_JOIN means we're looking for join-related advice.
39
* This includes join order advice, join method advice, and semijoin-uniqueness
40
* advice.
41
*
42
* PGPA_TROVE_LOOKUP_REL means we're looking for general advice about this
43
* a RelOptInfo that may correspond to either a scan or a join. This includes
44
* gather-related advice and partitionwise advice. Note that partitionwise
45
* advice might seem like join advice, but that's not a helpful way of viewing
46
* the matter because (1) partitionwise advice is also relevant at the scan
47
* level and (2) other types of join advice affect only what to do from
48
* join_path_setup_hook, but partitionwise advice affects what to do in
49
* joinrel_setup_hook.
50
*/
51
typedef
enum
pgpa_trove_lookup_type
52
{
53
PGPA_TROVE_LOOKUP_JOIN
,
54
PGPA_TROVE_LOOKUP_REL
,
55
PGPA_TROVE_LOOKUP_SCAN
56
}
pgpa_trove_lookup_type
;
57
58
/*
59
* This struct is used to store the result of a trove lookup. For each member
60
* of "indexes", the entry at the corresponding offset within "entries" is one
61
* of the results.
62
*/
63
typedef
struct
pgpa_trove_result
64
{
65
pgpa_trove_entry
*
entries
;
66
Bitmapset
*
indexes
;
67
}
pgpa_trove_result
;
68
69
extern
pgpa_trove
*
pgpa_build_trove
(
List
*
advice_items
);
70
extern
void
pgpa_trove_lookup
(
pgpa_trove
*trove,
71
pgpa_trove_lookup_type
type
,
72
int
nrids
,
73
pgpa_identifier
*rids,
74
pgpa_trove_result
*
result
);
75
extern
void
pgpa_trove_lookup_all
(
pgpa_trove
*trove,
76
pgpa_trove_lookup_type
type
,
77
pgpa_trove_entry
**entries,
78
int
*nentries);
79
extern
char
*
pgpa_cstring_trove_entry
(
pgpa_trove_entry
*entry);
80
extern
void
pgpa_trove_set_flags
(
pgpa_trove_entry
*entries,
81
Bitmapset
*indexes,
int
flags);
82
extern
void
pgpa_trove_append_flags
(
StringInfo
buf
,
int
flags);
83
84
#endif
bitmapset.h
result
uint32 result
Definition
checksum_block_internal.h:18
buf
static char buf[DEFAULT_XLOG_SEG_SIZE]
Definition
pg_test_fsync.c:71
pgpa_ast.h
pgpa_advice_tag_type
pgpa_advice_tag_type
Definition
pgpa_ast.h:81
pgpa_trove_set_flags
void pgpa_trove_set_flags(pgpa_trove_entry *entries, Bitmapset *indexes, int flags)
Definition
pgpa_trove.c:328
pgpa_trove_lookup_type
pgpa_trove_lookup_type
Definition
pgpa_trove.h:52
PGPA_TROVE_LOOKUP_SCAN
@ PGPA_TROVE_LOOKUP_SCAN
Definition
pgpa_trove.h:55
PGPA_TROVE_LOOKUP_JOIN
@ PGPA_TROVE_LOOKUP_JOIN
Definition
pgpa_trove.h:53
PGPA_TROVE_LOOKUP_REL
@ PGPA_TROVE_LOOKUP_REL
Definition
pgpa_trove.h:54
pgpa_build_trove
pgpa_trove * pgpa_build_trove(List *advice_items)
Definition
pgpa_trove.c:133
pgpa_trove_append_flags
void pgpa_trove_append_flags(StringInfo buf, int flags)
Definition
pgpa_trove.c:345
pgpa_trove_lookup_all
void pgpa_trove_lookup_all(pgpa_trove *trove, pgpa_trove_lookup_type type, pgpa_trove_entry **entries, int *nentries)
Definition
pgpa_trove.c:277
pgpa_cstring_trove_entry
char * pgpa_cstring_trove_entry(pgpa_trove_entry *entry)
Definition
pgpa_trove.c:297
pgpa_trove_lookup
void pgpa_trove_lookup(pgpa_trove *trove, pgpa_trove_lookup_type type, int nrids, pgpa_identifier *rids, pgpa_trove_result *result)
Definition
pgpa_trove.c:235
fb
static int fb(int x)
Definition
preproc-init.c:92
Bitmapset
Definition
bitmapset.h:50
List
Definition
pg_list.h:54
StringInfoData
Definition
stringinfo.h:47
pgpa_advice_target
Definition
pgpa_ast.h:48
pgpa_identifier
Definition
pgpa_identifier.h:20
pgpa_trove_entry
Definition
pgpa_trove.h:27
pgpa_trove_entry::target
pgpa_advice_target * target
Definition
pgpa_trove.h:29
pgpa_trove_entry::tag
pgpa_advice_tag_type tag
Definition
pgpa_trove.h:28
pgpa_trove_entry::flags
int flags
Definition
pgpa_trove.h:30
pgpa_trove_result
Definition
pgpa_trove.h:64
pgpa_trove_result::entries
pgpa_trove_entry * entries
Definition
pgpa_trove.h:65
pgpa_trove_result::indexes
Bitmapset * indexes
Definition
pgpa_trove.h:66
pgpa_trove
Definition
pgpa_trove.c:52
type
const char * type
Definition
wait_event_funcs.c:28
contrib
pg_plan_advice
pgpa_trove.h
Generated on Thu Apr 23 2026 12:13:09 for PostgreSQL Source Code by
1.9.8