Re: Query optimization problem - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Query optimization problem
Date
Msg-id AANLkTikGSh7jaEF3EoozKb56wV2uEt=Df0CFjfrABP3r@mail.gmail.com
Whole thread Raw
In response to Re: Query optimization problem  (Dimitri Fontaine <dfontaine@hi-media.com>)
Responses Re: Query optimization problem
Re: Query optimization problem
List pgsql-hackers
On Wed, Jul 28, 2010 at 6:55 AM, Dimitri Fontaine
<dfontaine@hi-media.com> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>>  But here you want to have different paths for
>> the same relation that generate *different output*, and the planner
>> doesn't understand that concept.
>
> Sorry? I though what Equivalence Class provides is the "proving" that
> using this qualification or another will *not* affect the output.

In a query like...
SELECT d1.ID, d2.IDFROM DocPrimary d1  JOIN DocPrimary d2 ON d2.BasedOn=d1.IDWHERE (d1.ID=234409763) or
(d2.ID=234409763)

...you're going to scan d1, scan d2, and then join the results.  The
scan of d1 is going to produce different results depending on whether
you evaluate or not d1.ID=234409763, and the scan of d2 is going to
produce different results depending on whether or not you evaluate
d2.BasedOn=234409763.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: PostGIS vs. PGXS in 9.0beta3
Next
From: Yeb Havinga
Date:
Subject: Re: Query optimization problem