Very newbie question - Mailing list pgsql-general

From Олег Самойлов
Subject Very newbie question
Date
Msg-id B3F74121-CECE-42D2-B0AB-5D7E6F3A466A@ya.ru
Whole thread Raw
Responses Re: Very newbie question  (Toomas <toomas.kristin@gmail.com>)
Re: Very newbie question  (Francisco Olarte <folarte@peoplecall.com>)
Re: Very newbie question  (Ron <ronljohnsonjr@gmail.com>)
Re: Very newbie question  (Олег Самойлов <splarv@ya.ru>)
List pgsql-general
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 by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Presentation tools used ?
Next
From: Toomas
Date:
Subject: Re: Very newbie question