PostgreSQL Zero Downtime Primary Key Conversion(fountain.engineering) |
PostgreSQL Zero Downtime Primary Key Conversion(fountain.engineering) |
In both cases, success or failure, before swapping a second time we needed to copy forward all the rows being inserted into the placeholder table.
Other disaster mitigations are capturing a dump of rows for the relevant partitions being modified with pg_dump. And having physical database backups with snapshots enabled and available if things really go wrong.