Re: BUG #12963: WHERE constraints on (INNER) JOIN columns are not propagated to both tables - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #12963: WHERE constraints on (INNER) JOIN columns are not propagated to both tables
Date
Msg-id 26322.1428330924@sss.pgh.pa.us
Whole thread Raw
In response to BUG #12963: WHERE constraints on (INNER) JOIN columns are not propagated to both tables  (gcp@sjeng.org)
List pgsql-bugs
gcp@sjeng.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

pgsql-bugs by date:

Previous
From: Peter Slavov
Date:
Subject: Re: BUG #12910: Memory leak with logical decoding
Next
From: cbalmeida@gmail.com
Date:
Subject: BUG #12989: pg_size_pretty with negative values