Re: Spped of max

From: Andrew Sullivan <andrew(at)libertyrms(dot)info>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Spped of max
Date: 2002-05-14 21:16:41
Message-ID: 20020514171641.N9748@mail.libertyrms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 14, 2002 at 01:35:47PM -0400, Edmund Dengler wrote:

>
> which flies as expected? Now, this type of thing gets me real worried
> about how good the optimizer really is.

The max() (and min()) operations are not rewritten, as you note.
There's no rule for it. There was a recent discussion about this --
check the archives.

There's a similar set of worries, apparently, for NOT EXISTS versus
NOT IN. In the vast majority of cases, it seems, NOT EXISTS is
considerably faster than NOT IN; but not in all cases. So the
queries are executed differently, and never get rewritten one to the
other. The only answer is to try to make sure your criteria-written
queries are generated in a way that is usually pretty good. For
sure, min() and max(), and NOT IN, and a couple of others (count()
comes to mind) are almost always losers, so you should avoid them.

A

--
----
Andrew Sullivan 87 Mowat Avenue
Liberty RMS Toronto, Ontario Canada
<andrew(at)libertyrms(dot)info> M6K 3E3
+1 416 646 3304 x110

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joel Burton 2002-05-14 21:18:04 Re: Begin / End blocks
Previous Message Andrew Sullivan 2002-05-14 19:57:47 Re: [JDBC] select * from mytable where myfield=null;