Skip unnecessary get_relids_in_jointree() when there are no PHVs Commit 1df9e8d96 made remove_useless_result_rtes() compute the set of baserels in the jointree, to pass down to the find_dependent_phvs() checks. But those checks are no-ops when the query contains no PHVs, since find_dependent_phvs() and find_dependent_phvs_in_jointree() both return early in that case. So we can avoid the get_relids_in_jointree() scan altogether when root->glob->lastPHId is zero, leaving baserels as NULL.
Author: Richard Guo <[email protected]> Reviewed-by: Tom Lane <[email protected]> Discussion: https://postgr.es/m/cambws49h275kzgzr3cd1hy+6lmwp35bz+5prvc62k3hdlj6...@mail.gmail.com Backpatch-through: 16 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b308eb3661bf41fa97e27909bf008871f438894c Modified Files -------------- src/backend/optimizer/prep/prepjointree.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
