Re: Query optimization problem - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: Query optimization problem
Date
Msg-id 871vanlu5g.fsf@hi-media-techno.com
Whole thread Raw
In response to Re: Query optimization problem  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
>  SELECT d1.ID, d2.ID
>  FROM DocPrimary d1
>    JOIN DocPrimary d2 ON d2.BasedOn=d1.ID
>  WHERE (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.

Well I just realised you can't use d2.BasedOn in scanning d1 here. I
don't know what exactly I had in mind previously, but in any case, sorry
for the noise.

I hope the optimiser effort control still hold water nonetheless…
--
dim


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Query optimization problem
Next
From: Pavel Stehule
Date:
Subject: patch saved in commitfest application isn't actual now