Robert Haas wrote:
> In defense of constraint exclusion, let me note that constraint
> exclusion is not restricted to inheritance cases. It could eliminate
> the need to scan a completely unpartitioned table if the WHERE clause
> can be refuted by CHECK constraints. It could eliminate the need to
> scan some partitions of a partitioned table based on whatever
> additional CHECK constraints exist beyond the partitioning
> constraints.
This is a great point that hadn't occurred to me. It means that we
should keep constraint exclusion on its own <sect2> rather than relegate
it to <sect3>, as my proposed patch does. I think it's a good idea to
add this point there too.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services