pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Greg Stark <gsstark@mit.edu>
Cc: scott.marlowe <scott.marlowe@ihs.com>
Cc: Neil Conway <neilc@samurai.com>
Cc: =?iso-8859-1?q? Pailloncy Jean-Gérard?= <pailloncy@ifrance.com>
Cc: PostgreSQL Performance <pgsql-performance@postgresql.org>
Subject: Re: slow plan for min/max
Date: Tue, 9 Sep 2003 13:49:54 -0500
Message-ID: <20030909184954.GA14198@wolff.to> (raw)
In-Reply-To: <87ad9d52dv.fsf@stark.dyndns.tv>
References: <Pine.LNX.4.33.0309081434150.11709-100000@css120.ihs.com>
	<87ad9d52dv.fsf@stark.dyndns.tv>

On Tue, Sep 09, 2003 at 12:54:04 -0400,
  Greg Stark <gsstark@mit.edu> wrote:
> 
> So what would it take to implement this for "all" aggregates? Where I think
> "all" really just means min(), max(), first(), last().

There can be other aggregates where indexes are helpful. The case of interest
is when functions such that if the new item is contains the current value
of the aggregate then the new value of the aggregate with be that of the
current item. This allows you to skip looking at all of the other items
contained in the current item. Dual problems can also benefit in a similar
manner. In a case where the set is totally ordered by the contains index
(as is the case or max and min) then the problem is even simpler and you
can use the greatest or least element as appropiate.



view thread (20+ messages)  latest in thread

Message-ID: <20030909184954.GA14198@wolff.to>
Permalink:  ../20030909184954.GA14198@wolff.to/
Also on:    postgresql.org/message-id/20030909184954.GA14198@wolff.to

 · 

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: bruno@wolff.to, gsstark@mit.edu, scott.marlowe@ihs.com, neilc@samurai.com, pailloncy@ifrance.com
  Subject: Re: slow plan for min/max
  In-Reply-To: <20030909184954.GA14198@wolff.to>
  References: <Pine.LNX.4.33.0309081434150.11709-100000@css120.ihs.com> <87ad9d52dv.fsf@stark.dyndns.tv> <20030909184954.GA14198@wolff.to>

* 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