pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Dror Matalon <dror@zapatec.com>
Cc: Postgresql Performance <pgsql-performance@postgresql.org>
Subject: Re: Speeding up Aggregates
Date: Thu, 9 Oct 2003 20:35:22 -0500
Message-ID: <20031010013522.GB18596@wolff.to> (raw)
In-Reply-To: <20031010004446.GN2979@rlx11.zapatec.com>
References: <20031003202120.GO87525@rlx11.zapatec.com>
	<1065217488.91586.3.camel@jester>
	<20031003215347.GQ87525@rlx11.zapatec.com>
	<1065219028.91586.8.camel@jester>
	<87llrvbx0f.fsf@stark.dyndns.tv>
	<20031008181819.GJ2979@rlx11.zapatec.com>
	<87ekxm9fjf.fsf@stark.dyndns.tv>
	<20031010004446.GN2979@rlx11.zapatec.com>

On Thu, Oct 09, 2003 at 17:44:46 -0700,
  Dror Matalon <dror@zapatec.com> wrote:
> 
> How is doing order by limit 1 faster than doing max()? Seems like the
> optimizer will need to sort or scan the data set either way. That part
> didn't actually make a difference in my specific case.

max() will never be evaluated by using an index to find the greatest value.
So in many cases using order by and limit 1 is faster.



view thread (22+ messages)  latest in thread

Message-ID: <20031010013522.GB18596@wolff.to>
Permalink:  ../20031010013522.GB18596@wolff.to/
Also on:    postgresql.org/message-id/20031010013522.GB18596@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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: bruno@wolff.to, dror@zapatec.com
  Subject: Re: Speeding up Aggregates
  In-Reply-To: <20031010013522.GB18596@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