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-2019, 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  * exprstates Array of ExprStates, indexed as per PruneCxtStateIdx; one
45  * for each partition key in each pruning step. Allocated if
46  * planstate is non-NULL, otherwise NULL.
47  */
48 typedef struct PartitionPruneContext
49 {
50  char strategy;
51  int partnatts;
52  int nparts;
61 
62 /*
63  * PruneCxtStateIdx() computes the correct index into the stepcmpfuncs[]
64  * and exprstates[] arrays for step step_id and partition key column keyno.
65  * (Note: there is code that assumes the entries for a given step are
66  * sequential, so this is not chosen freely.)
67  */
68 #define PruneCxtStateIdx(partnatts, step_id, keyno) \
69  ((partnatts) * (step_id) + (keyno))
70 
72  struct RelOptInfo *parentrel,
73  List *subpaths,
74  List *partitioned_rels,
75  List *prunequal);
78  List *pruning_steps);
79 
80 #endif /* PARTPRUNE_H */
Definition: fmgr.h:56
FmgrInfo * partsupfunc
Definition: partprune.h:55
Bitmapset * get_matching_partitions(PartitionPruneContext *context, List *pruning_steps)
Definition: partprune.c:716
FmgrInfo * stepcmpfuncs
Definition: partprune.h:56
MemoryContext ppccontext
Definition: partprune.h:57
unsigned int Oid
Definition: postgres_ext.h:31
PartitionPruneInfo * make_partition_pruneinfo(struct PlannerInfo *root, struct RelOptInfo *parentrel, List *subpaths, List *partitioned_rels, List *prunequal)
Definition: partprune.c:230
ExprState ** exprstates
Definition: partprune.h:59
struct PartitionPruneContext PartitionPruneContext
PartitionBoundInfo boundinfo
Definition: partprune.h:53
Bitmapset * prune_append_rel_partitions(struct RelOptInfo *rel)
Definition: partprune.c:650
Definition: pg_list.h:50
PlanState * planstate
Definition: partprune.h:58