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:
@ -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);
|
||||
|
Reference in New Issue
Block a user