diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-06-10 15:22:25 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-06-10 15:22:32 -0400 |
commit | 73b7f48f78d27b1baf1a6541cbaae0fe6bd6186d (patch) | |
tree | c5e92bd3ae8eed8d8cf3519c10b12982d44bcfa8 /src/include/nodes/primnodes.h | |
parent | c83e2029909c5411ca11fd841851016f1f9810e6 (diff) |
Improve run-time partition pruning to handle any stable expression.
The initial coding of the run-time-pruning feature only coped with cases
where the partition key(s) are compared to Params. That is a bit silly;
we can allow it to work with any non-Var-containing stable expression, as
long as we take special care with expressions containing PARAM_EXEC Params.
The code is hardly any longer this way, and it's considerably clearer
(IMO at least). Per gripe from Pavel Stehule.
David Rowley, whacked around a bit by me
Discussion: https://postgr.es/m/CAFj8pRBjrufA3ocDm8o4LPGNye9Y+pm1b9kCwode4X04CULG3g@mail.gmail.com
Diffstat (limited to 'src/include/nodes/primnodes.h')
-rw-r--r-- | src/include/nodes/primnodes.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index f90aa7b2a19..ef297cfaeda 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -1597,11 +1597,17 @@ typedef struct PartitionPruneInfo List *pruning_steps; /* List of PartitionPruneStep */ Bitmapset *present_parts; /* Indexes of all partitions which subnodes * are present for. */ - int nparts; /* The length of the following two arrays */ + int nparts; /* Length of subnode_map[] and subpart_map[] */ + int nexprs; /* Length of hasexecparam[] */ int *subnode_map; /* subnode index by partition id, or -1 */ int *subpart_map; /* subpart index by partition id, or -1 */ - Bitmapset *extparams; /* All external paramids seen in prunesteps */ - Bitmapset *execparams; /* All exec paramids seen in prunesteps */ + bool *hasexecparam; /* true if corresponding pruning_step contains + * any PARAM_EXEC Params. */ + bool do_initial_prune; /* true if pruning should be performed + * during executor startup. */ + bool do_exec_prune; /* true if pruning should be performed during + * executor run. */ + Bitmapset *execparamids; /* All PARAM_EXEC Param IDs in pruning_steps */ } PartitionPruneInfo; #endif /* PRIMNODES_H */ |