Jake
10/06/2022, 3:20 PMrelation_tuple_transaction
rows do you have?williamdclt
10/06/2022, 3:21 PMJake
10/06/2022, 4:02 PMwilliamdclt
10/06/2022, 6:12 PMIF NOT EXISTS
).
- Run the SQL statements manually, out of office hours, to minimise impact.
- Merge the migration. It's idempotent, shouldn't actually do anything, it's there for local/test environments.
- Note: it's very rare that we do need to take a big lock, Postgres usually has ways to avoid that
If the migration requires big DML that are going to be heavy (lock or resource-intensive):
- First, do any required DDL change in a separate migration. Has to be backward-compatible. Get that deployed.
- Write a job to do the DML changes. To update all rows of a big table for example, we'll probably chunk to avoid keeping locks for a long time
- We might want to make an idempotent migration for the DML change. We might also want to clean up the schema with another DDL migration. Depends on the use-caseJake
10/06/2022, 7:00 PMwilliamdclt
10/06/2022, 8:22 PMJake
10/07/2022, 7:33 PM