pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gavin Wahl <gavinwahl@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Planner Conceptual Error when Joining a Subquery -- Outer Query Condition not Pulled Into Subquery
Date: Wed, 16 Oct 2013 10:28:44 +0200
Message-ID: <7176.1381912124@sss.pgh.pa.us> (raw)
In-Reply-To: <CACPudh1CbbnQFMhOKfogG0k8dJdgRh03iH0e_vZ+sks+9Ye+-w@mail.gmail.com>
References: <CACPudh1CbbnQFMhOKfogG0k8dJdgRh03iH0e_vZ+sks+9Ye+-w@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

Gavin Wahl <gavinwahl@gmail.com> writes:
> It'd be nice if the planner could optimize the query (1) by turning it
> into (2). I understand that it might not be able to, but if it can pull
> the condition up in (3), why can't it in (4)?

(3) is an instance of seeing "a = b and b = c" and deducing "a = c" from
that.  (4) does not follow that pattern, so it's outside the realm of
what the planner can deduce.

In principle we could take "a = b and (b = c or b = d)" and deduce
"a = c or a = d" from that, but it'd be a lot more complication for a
lot less benefit than what we get from the existing logic.

			regards, tom lane


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



view thread (3+ messages)  latest in thread

Message-ID: <7176.1381912124@sss.pgh.pa.us>
Permalink:  ../7176.1381912124@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7176.1381912124@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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gavinwahl@gmail.com
  Subject: Re: Planner Conceptual Error when Joining a Subquery -- Outer Query Condition not Pulled Into Subquery
  In-Reply-To: <7176.1381912124@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