Re: is it possible to make this faster?

From: "Steinar H(dot) Gunderson" <sgunderson(at)bigfoot(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: is it possible to make this faster?
Date: 2006-05-25 20:36:30
Message-ID: 20060525203630.GA19881@uio.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, May 25, 2006 at 04:07:19PM -0400, Merlin Moncure wrote:
> been doing a lot of pgsql/mysql performance testing lately, and there
> is one query that mysql does much better than pgsql...and I see it a
> lot in normal development:
>
> select a,b,max(c) from t group by a,b;
>
> t has an index on a,b,c.

The planner _should_ TTBOMK be able to do it by itself in 8.1, but have you
tried something along the following lines?

select a,b,(select c from t t2 order by c desc where t1.a=t2.a and t1.b=t2.b)
from t t1 group by a,b;

/* Steinar */
--
Homepage: http://www.sesse.net/

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Bruno Wolff III 2006-05-25 20:47:46 Re: is it possible to make this faster?
Previous Message Merlin Moncure 2006-05-25 20:31:40 Re: is it possible to make this faster?