Re: slow plan for min/max

From: "Matt Clark" <matt(at)ymogen(dot)net>
To: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: slow plan for min/max
Date: 2003-09-08 23:17:09
Message-ID: LFEIJBEOKGPDHCEMDGNFEEGGCAAA.matt@ymogen.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


>This is a Frequently asked question about something that isn't likely to
>change any time soon.

You're right, it is in the FAQ, but pretty well buried. It is entirely
non-obvious to most people that min() and max() don't/can't use indices.
Something so counterintuitive should be explicitly and prominently
advertised, especially since the "order by X limit 1" workaround is so
simple.

Actually, referring down to later parts of this thread, why can't this
optimisation be performed internally for built-in types? I understand the
issue with aggregates over user-defined types, but surely optimising max()
for int4, text, etc is safe and easy?

Of course I may be so far out of my depth as to be drowning, in which case
please put me out of my misery.

M

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Matt Clark 2003-09-08 23:38:36 Re: slow plan for min/max
Previous Message Josh Berkus 2003-09-08 22:40:48 Re: slow plan for min/max