Please sign in to comment.
Removing DB column without downtime: cleanup, dropping indexes first
Based on an email from Heroku PG support: > I don't think the transaction was at fault at all - dropping columns requires holding some heavy locks that mean other work on the table is unlikely to proceed. Generally, I'd recommend dropping each index touching the column with DROP INDEX CONCURRENTLY before dropping the column itself. > > The DROP column commands requiring such an exclusive lock means that it can queue up behind other operations running against the database at that time. For example, if an analytical query is running, the DROP can queue behind that query, even if that query takes several hours. > > I suspect the timing of the DROP query interacted badly with another query running at the same time, causing the locking you saw. > > Removing transactions when dropping columns is not advised - it wouldn't have helped (as far as I can tell) in this case, it's a timing issue only. > > Thanks > > Tom Crayford > Heroku Postgres
- Loading branch information...