Re: is it possible to make this faster?

Поиск
Список
Период
Сортировка
От Steinar H. Gunderson
Тема Re: is it possible to make this faster?
Дата
Msg-id 20060525203630.GA19881@uio.no
обсуждение исходный текст
Ответ на is it possible to make this faster?  ("Merlin Moncure" <mmoncure@gmail.com>)
Ответы Re: is it possible to make this faster?  ("Merlin Moncure" <mmoncure@gmail.com>)
Re: is it possible to make this faster?  (Jeff - <threshar@torgo.978.org>)
Список 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/

В списке pgsql-performance по дате отправления:

Предыдущее
От: "Merlin Moncure"
Дата:
Сообщение: Re: is it possible to make this faster?
Следующее
От: Alan Hodgson
Дата:
Сообщение: Re: is it possible to make this faster?