Re: Index not being used in MAX function (7.2.3)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jim(at)nasby(dot)net
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Index not being used in MAX function (7.2.3)
Date: 2003-06-12 22:35:11
Message-ID: 21379.1055457311@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Jim C. Nasby" <jim(at)nasby(dot)net> writes:
> Am I just being naive, or couldn't this be solved by adding min/max
> boolean flags to pg_aggregates and the appropriate syntax to CREATE
> AGGREGATE?

I'd prefer to see a direct link to the associated sort operator
('<' for MIN or '>' for MAX). But yeah, some addition to the system
catalogs seems essential if you don't want the code to be full of
unsupportable assumptions about aggregate and operator names.

> So it seems the ORDER/LIMIT hack doesn't work well at all except in
> limited situations.

No kidding. This is one reason there hasn't been a huge push to get it
implemented: the actual usefulness of the hack is quite limited. In
your example, I suspect the presence of the unrelated WHERE clause is
what makes it unhelpful.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dmitry Tkach 2003-06-12 23:10:22 More VACUUM output?
Previous Message Jim C. Nasby 2003-06-12 22:26:11 Re: Index not being used in MAX function (7.2.3)