Re: Propogating conditions into a query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kim Bisgaard <kib+pg(at)dmi(dot)dk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Propogating conditions into a query
Date: 2005-06-23 14:22:53
Message-ID: 4795.1119536573@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Kim Bisgaard <kib+pg(at)dmi(dot)dk> writes:
> The reason the first query is not performing is because the query
> optimizer does not push the conditions down into the sub-queries - right??

Well, it's not the same condition: the WHERE clause is constraining
the output variable of the FULL JOIN, which is logically and
implementationally distinct from either input table's variable.
I suppose it is arguable that we could transform the WHERE clause into
constraints on the input variables --- but we'd have to think carefully
about the conditions under which such a transformation is valid.
Offhand it seems like it might work for strict non-volatile constraint
expressions that refer only to output variables of the JOIN; if they
refer to other tables too then I'm not sure.

This is by no means a "bug fix", but if I have time over the next week
I'll see whether it is feasible to write for 8.1.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-06-23 14:24:52 Re: multiple action rules
Previous Message Richard Huxton 2005-06-23 13:53:20 Re: Performance counters?