Re: Very newbie question
От
Toomas
Тема
Re: Very newbie question
Дата
Msg-id
AC086CDE-EA2A-41E3-A5BA-9D858BE5783B@gmail.com
Ответ на
Very newbie question (Олег Самойлов)
Список
Дерево обсуждения
Very newbie question Олег Самойлов <splarv@ya.ru>
Re: Very newbie question Олег Самойлов <splarv@ya.ru>
Re: Very newbie question Olivier Gautherot <ogautherot@gautherot.net>
Re: Very newbie question "Peter J. Holzer" <hjp-pgsql@hjp.at>
Re: Very newbie question Olivier Gautherot <ogautherot@gautherot.net>
Re: Very newbie question "Peter J. Holzer" <hjp-pgsql@hjp.at>
Re: Very newbie question Ron <ronljohnsonjr@gmail.com>
Re: Very newbie question Toomas <toomas.kristin@gmail.com>
Re: Very newbie question Олег Самойлов <splarv@ya.ru>
Re: Very newbie question Francisco Olarte <folarte@peoplecall.com>
Re: Very newbie question Олег Самойлов <splarv@ya.ru>
Re: Very newbie question Francisco Olarte <folarte@peoplecall.com>
There is no reason to use index. The query has neither WHERE nor ORDER BY clause. Toomas > On 23. Oct 2023, at 18:13, Олег Самойлов wrote: > > Back pardon, but I have a very newbie question. I have a partitioned table, partitioned by primary bigint key, size of partition 10000000. 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 по дате отправления