How to migrate an existing Postgres Table to partitioned table as transparently as possible?

In Postgres 10 “Declarative Partitioning” was introduced, which can relieve you of a good deal of work such as generating triggers or rules with huge if/else statements redirecting to the correct table. Postgres can do this automatically now. Let’s start with the migration: Rename the old table and create a new partitioned table alter table … Read more