Re: SELECT DISTINCT chooses parallel seqscan instead of indexscan on huge table with 1000 partitions - Mailing list pgsql-general

From Dimitrios Apostolou
Subject Re: SELECT DISTINCT chooses parallel seqscan instead of indexscan on huge table with 1000 partitions
Date
Msg-id a41651a5-d792-3198-568d-df110fc3bd31@gmx.net
Whole thread Raw
In response to Re: SELECT DISTINCT chooses parallel seqscan instead of indexscan on huge table with 1000 partitions  (Dimitrios Apostolou <jimis@gmx.net>)
List pgsql-general
I have forgotten to mention that I have enable_partitionwise_aggregate=on
in the global settings since the beginning. According to the docs:

> Enables or disables the query planner's use of partitionwise grouping or
> aggregation, which allows grouping or aggregation on partitioned tables
> to be performed separately for each partition.

Reading that, I'd expect to see a separate DISTINCT->LIMIT 10 on every
partition, and then it would be up to independent plans to decide whether
each partition follows a parallel or a serial plan.

Not sure if this plan was checked but rejected because of cost.


Dimitris




pgsql-general by date:

Previous
From: Dimitrios Apostolou
Date:
Subject: Re: SELECT DISTINCT chooses parallel seqscan instead of indexscan on huge table with 1000 partitions
Next
From: sud
Date:
Subject: Adding constraints faster