Partitioned queries

Now that the data is in the partitions, it's a good idea to update statistics. It's also important to confirm that the constraint_exclusion feature is active:

ANALYZE;
SHOW constraint_exclusion;
 constraint_exclusion 
----------------------
 partition  

constraint_exclusion allows the query planner to avoid including partitions in a query when it can prove they can't provide useful rows to satisfy it. In PostgreSQL 8.4 and later, the default value of partition turns this on, when partitioned tables are referenced, and off otherwise. In earlier versions, it defaults to off. You will have to turn the parameter on once you start using partitions in earlier versions if you expect them to work properly.

Queries against the whole ...

Get PostgreSQL 10 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.