HNHacker News
TopNewBestAskShowJobs

tbicr

61 karma · joined October 23, 2018

submissionscomments
tbicr··on Django zero-downtime migrations for Postgres that respect database locks
Unfortunately savepoints live only in transaction and ACCESS EXCLUSIVE will be released only on whole transaction commit/rollback, so look like no benefits with savepoints for schema migrations to compare with plain transaction.
tbicr··on Django zero-downtime migrations for Postgres that respect database locks
Constraints creation also tricky because in transaction it take ACCESS EXCLUSIVE lock (eg. lock table on READ/WRITE) and spend time to constraint validation (CHECK, NOT NULL, FOREIGN KEY), so lock will be released only on transaction commit/rollback.
tbicr··on Django zero-downtime migrations for Postgres that respect database locks
I found only two caveats:

- it doesn't use transactions, so if migration will down, then you will need to fix state manually (one point of improvement), however you cannot run `CREATE INDEX CONCURRENTLY` in transaction.

- it can use `CHECK (column IS NOT NULL)` constraint for safe `NOT NULL` replacement for huge tables, that isn't compatible with standard django behavior.

So all this cases highlighted in README.