Re: is it possible to make this faster?

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Cc: sgunderson(at)bigfoot(dot)com
Subject: Re: is it possible to make this faster?
Date: 2006-05-25 20:54:09
Message-ID: b42b73150605251354j283af4d3i3f24143d26230094@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 5/25/06, Steinar H. Gunderson <sgunderson(at)bigfoot(dot)com> wrote:
> 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;

> 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;

this came out to a tie with the group by approach, although it
produced a different (but similar) plan. we are still orders of
magnitude behind mysql here.

Interestingly, if I extract out the distinct values of a,b to a temp
table and rejoin to t using your approach, I get competitive times
with mysql. this means the essential problem is:

select a,b from t group by a,b

is slow. This feels like the same penalty for mvcc we pay with count(*)...hm.

merlin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Steinar H. Gunderson 2006-05-25 21:08:50 Re: is it possible to make this faster?
Previous Message Tom Lane 2006-05-25 20:52:27 Re: is it possible to make this faster?