Invalid But Still Costly
The migration runner wraps every file in BEGIN ... COMMIT. An engineer adds:
CREATE UNIQUE INDEX CONCURRENTLY orders_email_uniq ON orders (lower(email));
First attempt: ERROR: CREATE INDEX CONCURRENTLY cannot run inside a transaction block. She removes the wrapping transaction and reruns. This time it runs for twenty minutes, then fails on a uniqueness violation. \d orders now shows orders_email_uniq marked INVALID, and write latency on orders has gone up. What is true here?
Sign in to answer questions and track your progress
Sign In