pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matt Clark <matt@ymogen.net>
To: scott.marlowe <scott.marlowe@ihs.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: slow plan for min/max
Date: Tue, 9 Sep 2003 00:17:09 +0100
Message-ID: <LFEIJBEOKGPDHCEMDGNFEEGGCAAA.matt@ymogen.net> (raw)
In-Reply-To: <Pine.LNX.4.33.0309080954020.11520-100000@css120.ihs.com>


>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




view thread (20+ messages)  latest in thread

Message-ID: <LFEIJBEOKGPDHCEMDGNFEEGGCAAA.matt@ymogen.net>
Permalink:  ../LFEIJBEOKGPDHCEMDGNFEEGGCAAA.matt@ymogen.net/
Also on:    postgresql.org/message-id/LFEIJBEOKGPDHCEMDGNFEEGGCAAA.matt@ymogen.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: matt@ymogen.net, scott.marlowe@ihs.com
  Subject: Re: slow plan for min/max
  In-Reply-To: <LFEIJBEOKGPDHCEMDGNFEEGGCAAA.matt@ymogen.net>
  References: <Pine.LNX.4.33.0309080954020.11520-100000@css120.ihs.com> <LFEIJBEOKGPDHCEMDGNFEEGGCAAA.matt@ymogen.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox