pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: gcp@sjeng.org
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #12963: WHERE constraints on (INNER) JOIN columns are not propagated to both tables
Date: Mon, 06 Apr 2015 10:35:24 -0400
Message-ID: <26322.1428330924@sss.pgh.pa.us> (raw)
In-Reply-To: <20150404232113.2569.93814@wrigleys.postgresql.org>
References: <20150404232113.2569.93814@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)

Message-ID: <26322.1428330924@sss.pgh.pa.us>
Permalink:  ../26322.1428330924@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/26322.1428330924@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gcp@sjeng.org
  Subject: Re: BUG #12963: WHERE constraints on (INNER) JOIN columns are not propagated to both tables
  In-Reply-To: <26322.1428330924@sss.pgh.pa.us>
  References: <20150404232113.2569.93814@wrigleys.postgresql.org> <26322.1428330924@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox