On Sat, Aug 29, 2009 at 7:31 AM, Alban Hertroys<dalroi@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote: > What about foo_id = 100 AND foo_id % 8 = 100 % 8 ? > If the optimizer computes 100 % 8 before running the constraint matching then it would work. I'm not sure it does. foo_id=100 and foo_id % 8 = 4 will definitely match your constraint. Depending on how your code makes up the queries, you can bypass constraint exclusion and reference the sub table directly. This is how we do it. We have only one query in our entire system that cannot do this, because we always work on exactly one foo_id at a time except when doing global statistics which scan every row anyhow. There's really no point testing 100 constraints for a foo_id=100 type query since you can do that in your code before hand much more efficiently. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general