Re: Equivalent queries and the planner - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Equivalent queries and the planner
Date
Msg-id 20051015142405.GC14113@svana.org
Whole thread Raw
In response to Equivalent queries and the planner  ("John D. Burger" <john@mitre.org>)
List pgsql-general
On Fri, Oct 14, 2005 at 09:43:57AM -0400, John D. Burger wrote:
> (By the way, gazPlaces.gazPlaceID below is a primary key, so should be
> unique - I think that's required for these to be equivalent.  I tested
> the two queries on small data sets, and they do indeed return the same
> results.)

I think that you also have to be sure that gazPlaceID is never NULL.
AFAIK the PostgreSQL doesn't track that sort of thing at all at the
planning/optimisation stage.

You're right, sometimes statements are equivalent but usually there is
some corner case (like NULLs, duplicate values, etc) that screw it up
for the general case. Teaching the planner all that is something not
yet done.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-general by date:

Previous
From: Jan Wieck
Date:
Subject: Re: Oracle buys Innobase
Next
From: "Magnus Hagander"
Date:
Subject: Re: Windows Installation error