fatih ozturk <ozturkfa@xxxxxxxxx> writes: > My problem in partitioning is about using functions in table check constraints. By and large, you can't. Per the fine manual: Keep the partitioning constraints simple, else the planner may not be able to prove that partitions don't need to be visited. Use simple equality conditions for list partitioning, or simple range tests for range partitioning, as illustrated in the preceding examples. A good rule of thumb is that partitioning constraints should contain only comparisons of the partitioning column(s) to constants using B-tree-indexable operators. In particular, a constraint like "sel=123" is *not* going to lead the planner to draw any conclusions about the value of "mod(sel,6)". Now, if you'd written "WHERE mod(sel,6)=3", I think it would draw the right conclusions. The underlying issue here is that "a=b" does not imply "f(a)=f(b)" for all functions f, not even if "=" is known to be a btree equality operator. Several of PG's standard datatypes have counterexamples, so the planner *must* take this seriously. regards, tom lane -- Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin