Partitioning and constraint exclusion - Mailing list pgsql-general

From Jayadevan M
Subject Partitioning and constraint exclusion
Date
Msg-id CAFS1N4homc1VroymavL0shVg1E089t_kJM_3sKDMwG8vrhMqcw@mail.gmail.com
Whole thread Raw
Responses Re: Partitioning and constraint exclusion
Re: Partitioning and constraint exclusion
List pgsql-general
Hello ,

I have a parent table and 6 child tables (partitions). The child tables have check constraints defined in the form
CHECK (myuid in (123,456,..)).
myuid is bigint, the constraints for the 6 child tables are definitely mutually exclusive. The number of values in the list ranges from 2-10 for 5 of the child tables. For the 6th child table, the list is 2500+ elements. When I try explain/explain analyze for even a simple query like

select * from parent where myuid in (123,456,789) 

the child table with 2500+ elements gets always scanned. I have an index on the column and that does get used. But why doesn't the planner just use constraint exclusion and not go for the index scan? Anyone faced a similar issue?

Thanks,
Jayadevan

pgsql-general by date:

Previous
From: Ray Stell
Date:
Subject: Re: bdr admin role
Next
From: Giovanni Maruzzelli
Date:
Subject: Re: BDR global sequences in two machine failover