-
+
Data Definition
Constraint exclusion only works when the query's WHERE>
clause contains constants. A parameterized query will not be
- optimized, since the planner cannot know what partitions the
+ optimized, since the planner cannot know which partitions the
parameter value might select at run time. For the same reason,
stable> functions such as CURRENT_DATE
must be avoided.
- All constraints on all partitions of the master table are considered for
- constraint exclusion, so large numbers of partitions are likely to
- increase query planning time considerably.
+ 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 btree-indexable operators.
+
+
+
+
+ All constraints on all partitions of the master table are examined
+ during constraint exclusion, so large numbers of partitions are likely
+ to increase query planning time considerably.