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
20typedef 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 */
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 */
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 */
68
70extern void pgpa_trove_lookup(pgpa_trove *trove,
72 int nrids,
73 pgpa_identifier *rids,
75extern void pgpa_trove_lookup_all(pgpa_trove *trove,
77 pgpa_trove_entry **entries,
78 int *nentries);
80extern void pgpa_trove_set_flags(pgpa_trove_entry *entries,
81 Bitmapset *indexes, int flags);
82extern void pgpa_trove_append_flags(StringInfo buf, int flags);
83
84#endif
uint32 result
static char buf[DEFAULT_XLOG_SEG_SIZE]
pgpa_advice_tag_type
Definition pgpa_ast.h:81
void pgpa_trove_set_flags(pgpa_trove_entry *entries, Bitmapset *indexes, int flags)
Definition pgpa_trove.c:328
pgpa_trove_lookup_type
Definition pgpa_trove.h:52
@ PGPA_TROVE_LOOKUP_SCAN
Definition pgpa_trove.h:55
@ PGPA_TROVE_LOOKUP_JOIN
Definition pgpa_trove.h:53
@ PGPA_TROVE_LOOKUP_REL
Definition pgpa_trove.h:54
pgpa_trove * pgpa_build_trove(List *advice_items)
Definition pgpa_trove.c:133
void pgpa_trove_append_flags(StringInfo buf, int flags)
Definition pgpa_trove.c:345
void pgpa_trove_lookup_all(pgpa_trove *trove, pgpa_trove_lookup_type type, pgpa_trove_entry **entries, int *nentries)
Definition pgpa_trove.c:277
char * pgpa_cstring_trove_entry(pgpa_trove_entry *entry)
Definition pgpa_trove.c:297
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
static int fb(int x)
Definition pg_list.h:54
Definition pgpa_trove.h:27
pgpa_advice_target * target
Definition pgpa_trove.h:29
pgpa_advice_tag_type tag
Definition pgpa_trove.h:28
int flags
Definition pgpa_trove.h:30
pgpa_trove_entry * entries
Definition pgpa_trove.h:65
Bitmapset * indexes
Definition pgpa_trove.h:66
const char * type