From: Greg Stark <gsstark@mit.edu>
To: Rod Taylor <rbt@rbt.ca>
Cc: Dror Matalon <dror@zapatec.com>
Cc: Postgresql Performance <pgsql-performance@postgresql.org>
Subject: Re: Speeding up Aggregates
Date: 08 Oct 2003 10:54:24 -0400
Message-ID: <87llrvbx0f.fsf@stark.dyndns.tv> (raw)
In-Reply-To: <1065219028.91586.8.camel@jester>
References: <20031003202120.GO87525@rlx11.zapatec.com>
<1065217488.91586.3.camel@jester>
<20031003215347.GQ87525@rlx11.zapatec.com>
<1065219028.91586.8.camel@jester>
Rod Taylor <rbt@rbt.ca> writes:
> On Fri, 2003-10-03 at 17:53, Dror Matalon wrote:
> > On Fri, Oct 03, 2003 at 05:44:49PM -0400, Rod Taylor wrote:
> > >
> > > It is too bad the (channel, link) index doesn't have dtstamp at the end
> > > of it, otherwise the below query would be a gain (might be a small one
> > > anyway).
> > >
> > > select dtstamp
> > > from items
> > > where channel = $1
> > > and link = $2
> > > ORDER BY dtstamp DESC
> > > LIMIT 1;
>
> It didn't make a difference even with the 3 term index? I guess you
> don't have very many common values for channel / link combination.
You need to do:
ORDER BY channel DESC, link DESC, dtstamp DESC
This is an optimizer nit. It doesn't notice that since it selected on channel
and link already the remaining tuples in the index will be ordered simply by
dtstamp.
(This is the thing i pointed out previously in
<87el6ckrlu.fsf@stark.dyndns.tv> on Feb 13th 2003 on pgsql-general)
--
greg
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: gsstark@mit.edu, rbt@rbt.ca, dror@zapatec.com
Subject: Re: Speeding up Aggregates
In-Reply-To: <87llrvbx0f.fsf@stark.dyndns.tv>
* 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