Any way to optimize GROUP BY queries?

Поиск
Список
Период
Сортировка
От Cristian Prieto
Тема Any way to optimize GROUP BY queries?
Дата
Msg-id 00d701c604c1$e6945d80$6500a8c0@gt.ClickDiario.local
обсуждение исходный текст
Ответы Re: Any way to optimize GROUP BY queries?  (Greg Stark <gsstark@mit.edu>)
Список pgsql-performance

I have the following table:

 

CREATE TABLE mytmp (

            Adv integer,

            Pub integer,

            Web integer,

            Tiempo timestamp,

            Num integer,

            Country varchar(2)

);

 

CREATE INDEX idx_mytmp ON mytmp(adv, pub, web);

 

And with 16M rows this query:

 

SELECT adv, pub, web, country, date_trunc(‘hour’, tiempo), sum(num)

FROM mytmp GROUP BY adv, pub, web, country, date_trunc(‘hour’, tiempo)

 

I’ve tried to create index in different columns but it seems that the group by clause doesn’t use the index in any way.

 

Is around there any stuff to accelerate the group by kind of clauses?

 

Thanks a lot…

 

 

 

Вложения

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

Предыдущее
От: "Luke Lonergan"
Дата:
Сообщение: Re: PostgreSQL and Ultrasparc T1
Следующее
От: James Klo
Дата:
Сообщение: Re: make bulk deletes faster?