Re: improving a badly optimized query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brandon Craig Rhodes <brandon(at)oit(dot)gatech(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: improving a badly optimized query
Date: 2002-11-22 16:34:13
Message-ID: 24969.1037982853@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Brandon Craig Rhodes <brandon(at)oit(dot)gatech(dot)edu> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>> It seems like a useful optimization, but I have an uncomfortable
>> feeling that there's something wrong with it. Can you point to a
>> rigorous proof that this is okay in complicated contexts such as
>> nested outer joins?

> We can optimize the above query simply by observing that the result of
> a LEFT JOIN includes both the rows that would have been produced by a
> simple JOIN, and those rows of the left table that did not match any
> from the right. [snip]

You didn't answer my question: when there are *nested* outer joins, how
does this transformation apply? Can a clause from WHERE or an
upper-level JOIN/ON clause be pushed down past one outer join and into
another?

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2002-11-22 16:37:30 Re: help in starting up / shutting down postgres as another
Previous Message scott.marlowe 2002-11-22 16:31:33 Re: Lack of use of indexes