Re: SELECT DISTINCT chooses parallel seqscan instead of indexscan on huge table with 1000 partitions

Поиск
Список
Период
Сортировка
От Dimitrios Apostolou
Тема Re: SELECT DISTINCT chooses parallel seqscan instead of indexscan on huge table with 1000 partitions
Дата
Msg-id 8c923989-7944-d139-5ade-3d9f2588a11d@gmx.net
обсуждение исходный текст
Ответ на Re: SELECT DISTINCT chooses parallel seqscan instead of indexscan on huge table with 1000 partitions  (Dimitrios Apostolou <jimis@gmx.net>)
Ответы Re: SELECT DISTINCT chooses parallel seqscan instead of indexscan on huge table with 1000 partitions  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-general
On Mon, 13 May 2024, Dimitrios Apostolou wrote:

> On Sat, 11 May 2024, David Rowley wrote:
>
>>  On Sat, 11 May 2024 at 13:11, Dimitrios Apostolou <jimis@gmx.net> wrote:
>>>  Indeed that's an awful estimate, the table has more than 1M of unique
>>>  values in that column. Looking into pg_stat_user_tables, I can't see the
>>>  partitions having been vacuum'd or analyzed at all. I think they should
>>>  have been auto-analyzed, since they get a ton of INSERTs
>>>  (no deletes/updates though) and I have the default autovacuum settings.
>>>  Could it be that autovacuum starts, but never
>>>  finishes? I can't find something in the logs.
>>
>>  It's not the partitions getting analyzed you need to worry about for
>>  an ndistinct estimate on the partitioned table. It's auto-analyze or
>>  ANALYZE on the partitioned table itself that you should care about.
>>
>>  If you look at [1], it says "Tuples changed in partitions and
>>  inheritance children do not trigger analyze on the parent table."
>
> Thanks

Do I read that correctly, that I have to setup cron jobs to manually
analyze partitioned tables?


Dimitris




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

Предыдущее
От: Dimitrios Apostolou
Дата:
Сообщение: Re: SELECT DISTINCT chooses parallel seqscan instead of indexscan on huge table with 1000 partitions
Следующее
От: David Rowley
Дата:
Сообщение: Re: SELECT DISTINCT chooses parallel seqscan instead of indexscan on huge table with 1000 partitions