diff options
| author | Tom Lane | 2018-06-10 19:22:25 +0000 |
|---|---|---|
| committer | Tom Lane | 2018-06-10 19:22:32 +0000 |
| commit | 73b7f48f78d27b1baf1a6541cbaae0fe6bd6186d (patch) | |
| tree | c5e92bd3ae8eed8d8cf3519c10b12982d44bcfa8 /src/include/partitioning | |
| 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/partitioning')
| -rw-r--r-- | src/include/partitioning/partprune.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/include/partitioning/partprune.h b/src/include/partitioning/partprune.h index 3d114b4c71f..e3b3bfb7c11 100644 --- a/src/include/partitioning/partprune.h +++ b/src/include/partitioning/partprune.h @@ -40,23 +40,27 @@ typedef struct PartitionPruneContext PartitionBoundInfo boundinfo; /* - * Can be set when the context is used from the executor to allow params - * found matching the partition key to be evaluated. + * This will be set when the context is used from the executor, to allow + * Params to be evaluated. */ PlanState *planstate; /* - * Parameters that are safe to be used for partition pruning. execparams - * are not safe to use until the executor is running. - */ - Bitmapset *safeparams; - - /* * Array of ExprStates, indexed as per PruneCtxStateIdx; one for each * partkey in each pruning step. Allocated if planstate is non-NULL, * otherwise NULL. */ ExprState **exprstates; + + /* + * Similar array of flags, each true if corresponding 'exprstate' + * expression contains any PARAM_EXEC Params. (Can be NULL if planstate + * is NULL.) + */ + bool *exprhasexecparam; + + /* true if it's safe to evaluate PARAM_EXEC Params */ + bool evalexecparams; } PartitionPruneContext; #define PruneCxtStateIdx(partnatts, step_id, keyno) \ |
