I've been working with partitions (I have split my table in around 3000 partitions), and if i did some like this
SELECT *
FROM my_parent_table
WHERE some_value_in_which_partitioned_my_table in (34, 36, 48)
constraint_exclusion works, (looking EXPLAIN, I can see that in planner only check the partition_table with CHECH id in 34, 36 and 48. Great!
But if I increase the amount of ids, constraint_exclusion don't work.
SELECT *
FROM my_parent_table
WHERE some_id in (34, 36, 48, 65, ... 234, 310) (in total, 101 different ids)
When i do a query like that, EXPLAIN show me that ALL the partitioned tables (3000) are checked (and, of course, the Query is too slow)
What is happening?
SELECT *
FROM my_parent_table
WHERE some_value_in_which_partitioned_my_table in (34, 36, 48)
constraint_exclusion works, (looking EXPLAIN, I can see that in planner only check the partition_table with CHECH id in 34, 36 and 48. Great!
But if I increase the amount of ids, constraint_exclusion don't work.
SELECT *
FROM my_parent_table
WHERE some_id in (34, 36, 48, 65, ... 234, 310) (in total, 101 different ids)
When i do a query like that, EXPLAIN show me that ALL the partitioned tables (3000) are checked (and, of course, the Query is too slow)
What is happening?