1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-12 21:01:52 +03:00

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
This commit is contained in:
Alvaro Herrera
2018-04-24 14:03:10 -03:00
parent 055fb8d33d
commit 1957f8dabf
3 changed files with 61 additions and 10 deletions

View File

@ -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);