DATE_TRUNC() and GROUP BY?

Поиск
Список
Период
Сортировка
От Dave Johansen
Тема DATE_TRUNC() and GROUP BY?
Дата
Msg-id CAAcYxUesJhma7VDJ_FpT8fH-JWVgQ_KsLX8z-6hjHq-YDuU9Dw@mail.gmail.com
обсуждение исходный текст
Ответы Re: DATE_TRUNC() and GROUP BY?  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-performance
I just ran into an interesting issue on Postgres 8.4. I have a database with about 3 months of data and when I do following query:
SELECT DATE_TRUNC('day', time) AS time_t, COUNT(*) FROM mytable GROUP BY time_t;

EXPLAIN shows that it's doing a sort and then a GroupAggregate. There will only be ~90 outputs, so is there a way I can hint/force the planner to just do a HashAggregate?

Just to see if it would change the plan, I tried increasing the work_mem up to 1GB and it still did the same plan.

Thanks,
Dave

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

Предыдущее
От: Steve Crawford
Дата:
Сообщение: Re: Regarding Hardware Tuning
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: Regarding Hardware Tuning