Day 23 10 min
Tables and indexes
1 / 12 · ≈ 8 min left
The problem
Your team adds support tickets to the app. You write the migration: two new tables, then columns and indexes added later, while the app keeps writing tickets. A plain CREATE INDEX blocks inserts, updates and deletes on the table until the index is built.
The database is PostgreSQL. It starts with the table users (id bigint PRIMARY KEY, email text NOT NULL) and a few users in it. Each rep runs on the database that the reps before it left. Rep 2 creates tickets, and the app adds a few tickets before rep 3.