Summary
Every form of partitioning in PostgreSQL currently requires a moderate amount of manual setup. Accordingly, it's not something you want to do by default. There needs to be sufficient justification in terms of expected improvement in scalability before partitioning your tables will make sense. When it is effective, partitioning can dramatically speed up some types of queries against the database, improving overall system efficiency.
- Partitioning large tables normally makes sense when they or the active portion of a database as a whole exceeds the total amount of memory in the server.
- Choosing what key field to partition over needs to carefully review all queries made against the table, to make sure they are selective against that field.
- Individual partitions need to be created manually, along with having any constraints, indexes, or permissions against the parent applied to them as well.
- Trigger functions are the easiest way to redirect
INSERT
,UPDATE
, orDELETE
statements...