diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-08-17 15:35:51 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-08-17 15:35:51 -0400 |
commit | 6569ca43973b754e8213072c8ddcae9e7baf2aaa (patch) | |
tree | 396627f9ae41b4bd5f069cd20c142d30d62b8b59 /src/backend/optimizer/plan/planmain.c | |
parent | efd0c16becbf45e3b0215e124fde75fee8fcbce4 (diff) | |
download | postgresql-6569ca43973b754e8213072c8ddcae9e7baf2aaa.tar.gz postgresql-6569ca43973b754e8213072c8ddcae9e7baf2aaa.zip |
Make PlaceHolderInfo lookup O(1).
Up to now we've just searched the placeholder_list when we want to
find the PlaceHolderInfo with a given ID. While there's no evidence
of that being a problem in the field, an upcoming patch will add
find_placeholder_info() calls in build_joinrel_tlist(), which seems
likely to make it more of an issue: a joinrel emitting lots of
PlaceHolderVars would incur O(N^2) cost, and we might be building
a lot of joinrels in complex queries. Hence, add an array that
can be indexed directly by phid to make the lookups constant-time.
Discussion: https://postgr.es/m/1405792.1660677844@sss.pgh.pa.us
Diffstat (limited to 'src/backend/optimizer/plan/planmain.c')
-rw-r--r-- | src/backend/optimizer/plan/planmain.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c index c92ddd27ed1..248cde4d9bd 100644 --- a/src/backend/optimizer/plan/planmain.c +++ b/src/backend/optimizer/plan/planmain.c @@ -75,6 +75,8 @@ query_planner(PlannerInfo *root, root->full_join_clauses = NIL; root->join_info_list = NIL; root->placeholder_list = NIL; + root->placeholder_array = NULL; + root->placeholder_array_size = 0; root->fkey_list = NIL; root->initial_rels = NIL; |