Re: Speeding up Aggregates

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Dror Matalon <dror(at)zapatec(dot)com>
Cc: Postgresql Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Speeding up Aggregates
Date: 2003-10-10 01:35:22
Message-ID: 20031010013522.GB18596@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, Oct 09, 2003 at 17:44:46 -0700,
Dror Matalon <dror(at)zapatec(dot)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.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Dennis Bjorklund 2003-10-10 03:21:24 Re: OFFTOPIC: PostgreSQL vs MySQL
Previous Message Dror Matalon 2003-10-10 00:44:46 Re: Speeding up Aggregates