Decision#d1
Catalogue / kylehailey-2023-postgres-partition-conversion
An 8TB Postgres table on Cloud SQL is converted to a partitioned table in a 50-minute window, with two constraint outages around it
Not named in the source, 2023. PostgreSQL database on Google Cloud SQL holding an 8TB table, converted to range partitions.
Records
Decision#d2
Build the new primary key ahead of time as a concurrent unique index, then promote it at cutover
Decision#d3
Mark the date-range check constraint as validated in the catalog instead of scanning the table
Decision#d4
Switch autovacuum off for the conversion window through a scripted Cloud SQL flag change
Decision#d5
Add each daily partition as a standalone table with a matching constraint, then attach it
Failure#f1
A check constraint bounded at UTC midnight stops the database at 5pm Pacific before the conversion
Failure#f2
The new partitioned table inherits the old table's date-range constraint and stops all transactions the next day
Failure#f3
Triggers do not carry over to the new partitioned table, and data they would have written goes missing
Sign in to read what was chosen, what was rejected and what it cost, each with its place in the source. An account is free. The job-queue cards are open without one.