Very newbie question

Поиск
Список
Период
Сортировка
Back pardon, but I have a very newbie question. I have a partitioned table, partitioned by primary bigint key, size of
partition10000000. I need to get the number of partition which need to archive, which has all rows are olden then 3
month.Here is query: 

SELECT id/10000000 as partition
   FROM delivery
   GROUP BY partition
   HAVING max(created_at) < CURRENT_DATE - '3 month'::interval;

The 'id/10000000 as partition' is a number of the partition, it later will be used inside the partition name.
The query runs long by sequence scan. Has anyone any ideas how to rewrite query so it will use any index?


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Presentation tools used ?
Следующее
От: Toomas
Дата:
Сообщение: Re: Very newbie question