Re: BUG #12963: WHERE constraints on (INNER) JOIN columns are not propagated to both tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: gcp(at)sjeng(dot)org
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #12963: WHERE constraints on (INNER) JOIN columns are not propagated to both tables
Date: 2015-04-06 14:35:24
Message-ID: 26322.1428330924@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

gcp(at)sjeng(dot)org writes:
> That is, when given:
> join matches on matches.seq = matches_players.seq
> where matches.seq > 1151575404 and matches.seq < 1155066769
> there should be no need to add:
> and matches_players.seq > 1151575404 and matches_players.seq <
> 1155066769;
> because this is implied by the JOIN ON.

We do make deductions of this sort for equality constraints, but not for
inequalities. There are no plans to teach the planner to do such
deductions. Sorry, but for most queries trying to propagate inequalities
would just chew up planning cycles with little result. The fact that when
it does apply it can be a big win doesn't convince me that it wouldn't be
a net loss overall.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Slavov 2015-04-06 14:55:44 Re: BUG #12910: Memory leak with logical decoding
Previous Message Andres Freund 2015-04-06 13:50:26 Re: BUG #12910: Memory leak with logical decoding