agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Richard Guo <rguo@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Skip unnecessary get_relids_in_jointree() when there are no PHVs
Date: Mon, 20 Jul 2026 03:18:37 +0000
Message-ID: <E1wleWc-000Cus-0u@gemulon.postgresql.org> (raw)
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 <guofenglinux@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAMbWs49H275KzgZr3Cd1Hy+6Lmwp35bZ+5PrVc62k3HDLj6hNQ@mail.gmail.com
Backpatch-through: 16
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/72457f1df803bba077b338d5ed3fb8418e69967d
Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
view thread (6+ messages) latest in thread
Message-ID: <E1wleWc-000Cus-0u@gemulon.postgresql.org>
Permalink: ../E1wleWc-000Cus-0u@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1wleWc-000Cus-0u@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: rguo@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Skip unnecessary get_relids_in_jointree() when there are no PHVs
In-Reply-To: <E1wleWc-000Cus-0u@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox