PostgreSQL Source Code
git master
partprune.h
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
*
3
* partprune.h
4
* prototypes for partprune.c
5
*
6
*
7
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
8
* Portions Copyright (c) 1994, Regents of the University of California
9
*
10
* src/include/partitioning/partprune.h
11
*
12
*-------------------------------------------------------------------------
13
*/
14
#ifndef PARTPRUNE_H
15
#define PARTPRUNE_H
16
17
#include "
nodes/execnodes.h
"
18
#include "
partitioning/partdefs.h
"
19
20
struct
PlannerInfo
;
/* avoid including pathnodes.h here */
21
struct
RelOptInfo
;
22
23
24
/*
25
* PartitionPruneContext
26
* Stores information needed at runtime for pruning computations
27
* related to a single partitioned table.
28
*
29
* strategy Partition strategy, e.g. LIST, RANGE, HASH.
30
* partnatts Number of columns in the partition key.
31
* nparts Number of partitions in this partitioned table.
32
* boundinfo Partition boundary info for the partitioned table.
33
* partcollation Array of partnatts elements, storing the collations of the
34
* partition key columns.
35
* partsupfunc Array of FmgrInfos for the comparison or hashing functions
36
* associated with the partition keys (partnatts elements).
37
* (This points into the partrel's partition key, typically.)
38
* stepcmpfuncs Array of FmgrInfos for the comparison or hashing function
39
* for each pruning step and partition key.
40
* ppccontext Memory context holding this PartitionPruneContext's
41
* subsidiary data, such as the FmgrInfos.
42
* planstate Points to the parent plan node's PlanState when called
43
* during execution; NULL when called from the planner.
44
* exprcontext ExprContext to use when evaluating pruning expressions
45
* exprstates Array of ExprStates, indexed as per PruneCxtStateIdx; one
46
* for each partition key in each pruning step. Allocated if
47
* planstate is non-NULL, otherwise NULL.
48
*/
49
typedef
struct
PartitionPruneContext
50
{
51
char
strategy
;
52
int
partnatts
;
53
int
nparts
;
54
PartitionBoundInfo
boundinfo
;
55
Oid
*
partcollation
;
56
FmgrInfo
*
partsupfunc
;
57
FmgrInfo
*
stepcmpfuncs
;
58
MemoryContext
ppccontext
;
59
PlanState
*
planstate
;
60
ExprContext
*
exprcontext
;
61
ExprState
**
exprstates
;
62
}
PartitionPruneContext
;
63
64
/*
65
* PruneCxtStateIdx() computes the correct index into the stepcmpfuncs[]
66
* and exprstates[] arrays for step step_id and partition key column keyno.
67
* (Note: there is code that assumes the entries for a given step are
68
* sequential, so this is not chosen freely.)
69
*/
70
#define PruneCxtStateIdx(partnatts, step_id, keyno) \
71
((partnatts) * (step_id) + (keyno))
72
73
extern
int
make_partition_pruneinfo
(
struct
PlannerInfo
*
root
,
74
struct
RelOptInfo
*parentrel,
75
List
*subpaths,
76
List
*prunequal);
77
extern
Bitmapset
*
prune_append_rel_partitions
(
struct
RelOptInfo
*rel);
78
extern
Bitmapset
*
get_matching_partitions
(
PartitionPruneContext
*context,
79
List
*pruning_steps);
80
81
#endif
/* PARTPRUNE_H */
execnodes.h
partdefs.h
get_matching_partitions
Bitmapset * get_matching_partitions(PartitionPruneContext *context, List *pruning_steps)
Definition:
partprune.c:846
prune_append_rel_partitions
Bitmapset * prune_append_rel_partitions(struct RelOptInfo *rel)
Definition:
partprune.c:779
PartitionPruneContext
struct PartitionPruneContext PartitionPruneContext
make_partition_pruneinfo
int make_partition_pruneinfo(struct PlannerInfo *root, struct RelOptInfo *parentrel, List *subpaths, List *prunequal)
Definition:
partprune.c:224
Oid
unsigned int Oid
Definition:
postgres_ext.h:32
root
tree ctl root
Definition:
radixtree.h:1857
Bitmapset
Definition:
bitmapset.h:50
ExprContext
Definition:
execnodes.h:263
ExprState
Definition:
execnodes.h:88
FmgrInfo
Definition:
fmgr.h:57
List
Definition:
pg_list.h:54
MemoryContextData
Definition:
memnodes.h:118
PartitionBoundInfoData
Definition:
partbounds.h:80
PartitionPruneContext
Definition:
partprune.h:50
PartitionPruneContext::partsupfunc
FmgrInfo * partsupfunc
Definition:
partprune.h:56
PartitionPruneContext::exprcontext
ExprContext * exprcontext
Definition:
partprune.h:60
PartitionPruneContext::nparts
int nparts
Definition:
partprune.h:53
PartitionPruneContext::strategy
char strategy
Definition:
partprune.h:51
PartitionPruneContext::ppccontext
MemoryContext ppccontext
Definition:
partprune.h:58
PartitionPruneContext::boundinfo
PartitionBoundInfo boundinfo
Definition:
partprune.h:54
PartitionPruneContext::partcollation
Oid * partcollation
Definition:
partprune.h:55
PartitionPruneContext::planstate
PlanState * planstate
Definition:
partprune.h:59
PartitionPruneContext::stepcmpfuncs
FmgrInfo * stepcmpfuncs
Definition:
partprune.h:57
PartitionPruneContext::exprstates
ExprState ** exprstates
Definition:
partprune.h:61
PartitionPruneContext::partnatts
int partnatts
Definition:
partprune.h:52
PlanState
Definition:
execnodes.h:1148
PlannerInfo
Definition:
pathnodes.h:220
RelOptInfo
Definition:
pathnodes.h:887
src
include
partitioning
partprune.h
Generated on Thu Mar 20 2025 06:13:25 for PostgreSQL Source Code by
1.9.4