Re: Speeding up Aggregates

Поиск
Список
Период
Сортировка
От Rod Taylor
Тема Re: Speeding up Aggregates
Дата
Msg-id 1065219028.91586.8.camel@jester
обсуждение исходный текст
Ответ на Re: Speeding up Aggregates  (Dror Matalon <dror@zapatec.com>)
Ответы Re: Speeding up Aggregates  (Dror Matalon <dror@zapatec.com>)
Re: Speeding up Aggregates  (Greg Stark <gsstark@mit.edu>)
Список pgsql-performance
On Fri, 2003-10-03 at 17:53, Dror Matalon wrote:
> On Fri, Oct 03, 2003 at 05:44:49PM -0400, Rod Taylor wrote:
> > > item_max_date() looks like this:
> > >    select max(dtstamp) from items where channel = $1 and link = $2;
> >
> > It is too bad the (channel, link) index doesn't have dtstamp at the end
> > of it, otherwise the below query would be a gain (might be a small one
> > anyway).
> >
> >   select dtstamp
> >     from items
> >    where channel = $1
> >      and link = $2
> > ORDER BY dtstamp DESC
> >    LIMIT 1;

It didn't make a difference even with the 3 term index? I guess you
don't have very many common values for channel / link combination.



How about the below? Note the word STABLE on the end.

CREATE or REPLACE FUNCTION item_max_date (int4, varchar) RETURNS
timestamptz AS '
select max(dtstamp) from items where channel = $1 and link = $2;
' LANGUAGE 'sql' STABLE;

Вложения

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

Предыдущее
От: Dror Matalon
Дата:
Сообщение: Re: Speeding up Aggregates
Следующее
От: Neil Conway
Дата:
Сообщение: Re: reindex/vacuum locking/performance?