On Sat, Oct 14, 2017 at 3:15 AM, Gourav Kumar <gourav1905@gmail.com> wrote:
> Why does have_relevant_joinclause() and have_relevant_eclass_joinclause()
> return true for all possible joins for the query given below.
> Even when they have no join predicate between them.
> e.g. join between ss1 & ws3, ss2 & ws3 etc.
>
The prologues of those functions and comments within those explain that.
/** have_relevant_joinclause* Detect whether there is a joinclause that involves* the two given relations.**
Note:the joinclause does not have to be evaluable with only these two* relations. This is intentional. For example
consider* SELECT * FROM a, b, c WHERE a.x = (b.y + c.z)* If a is much larger than the other tables, it may be
worthwhileto* cross-join b and c and then use an inner indexscan on a.x. Therefore* we should consider this joinclause
asreason to join b to c, even though* it can't be applied at that join step.*/
/** have_relevant_eclass_joinclause* Detect whether there is an EquivalenceClass that could produce* a
joinclauseinvolving the two given relations.** This is essentially a very cut-down version of*
generate_join_implied_equalities(). Note it's OK to occasionally say "yes"* incorrectly. Hence we don't bother with
detailslike whether the lack of a* cross-type operator might prevent the clause from actually being generated.*/
May be you want to see whether those comments are applicable in your
case and also see how the callers handle the return values.
--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers