diff options
| author | Alvaro Herrera | 2018-04-24 17:03:10 +0000 |
|---|---|---|
| committer | Alvaro Herrera | 2018-04-24 17:03:10 +0000 |
| commit | 1957f8dabf8daa29c78d05f971dd665c9680a754 (patch) | |
| tree | 23abbf9a7aee99037f19e60c64d5a7a0448579ad /src/include/partitioning/partprune.h | |
| parent | 055fb8d33da6ff9003e3da4b9944bdcd2e2b2a49 (diff) | |
Initialize ExprStates once in run-time partition pruning
Instead of doing ExecInitExpr every time a Param needs to be evaluated
in run-time partition pruning, do it once during run-time pruning
set-up and cache the exprstate in PartitionPruneContext, saving a lot of
work.
Author: David Rowley
Reviewed-by: Amit Langote, Álvaro Herrera
Discussion: https://postgr.es/m/CAKJS1f8-x+q-90QAPDu_okhQBV4DPEtPz8CJ=m0940GyT4DA4w@mail.gmail.com
Diffstat (limited to 'src/include/partitioning/partprune.h')
| -rw-r--r-- | src/include/partitioning/partprune.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/include/partitioning/partprune.h b/src/include/partitioning/partprune.h index a5568abce65..c9fe95dc30c 100644 --- a/src/include/partitioning/partprune.h +++ b/src/include/partitioning/partprune.h @@ -50,8 +50,17 @@ typedef struct PartitionPruneContext * 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; } PartitionPruneContext; +#define PruneCxtStateIdx(partnatts, step_id, keyno) \ + ((partnatts) * (step_id) + (keyno)) extern List *make_partition_pruneinfo(PlannerInfo *root, List *partition_rels, List *subpaths, List *prunequal); |
