What is Constraint Exclusion?
Constraint Exclusion is a feature introduced in PostgreSQL 8.1 which is used in conjunction with Table Inheritance to implement
table partitioning strategies. The basic idea is you put check constraints on tables to limit what kind of data can be inserted into it.
Constraint Exclusion will then in theory skip over tables whose check constraints guarantee there is no way for it to satisfy the
condition of a query.
Constraint Exclusion is a great thing, but it has some limitations and quirks one needs to be aware of that in some cases
will prevent it from kicking in. Below are a couple of reasons why it sometimes doesn't work.