TechNewsHeaven {{}}

2018-10-23T13:54:40.1616624Z - tbicr / Hacker News
Django postgresql backend that apply migrations with respect to database locks. Postgres row level locksAs business logic mostly works with table rows it's also important to understand lock conflicts on row level FOR KEY SHARE FOR SHARE FOR NO KEY UPDATE FOR UPDATE FOR KEY SHARE X FOR SHARE X X FOR NO KEY UPDATE X X X FOR UPDATE X X X XMain point there is if you have two transactions that update one row, then second transaction will wait until first will be completed. This migrations are pretty safe, because your logic doesn't work with this data before migrationChanges for working logicMigrations: ALTER TABLE RENAME TO , ALTER TABLE SET TABLESPACE , ALTER TABLE RENAME COLUMN . Dealing with UNIQUE constraintPostgres has two approaches for uniqueness: CREATE UNIQUE INDEX and ALTER TABLE ADD CONSTRAINT UNIQUE - both use unique index inside. However still unclear what difference for DROP INDEX and DROP INDEX CONCURRENTLY except difference in locks, but as you see before both marked as safe - you don't spend time in DROP INDEX , just wait for lock.

Your favorite news

Popular news

Recommended news