A long-running migration script included a large batch insert but lacked proper transaction handling. One batch failed, which kept the entire transaction open. Since PostgreSQL uses MVCC (Multi-Version Concurrency Control), the uncommitted transaction held row-level locks, which prevented concurrent write operations.
pg_stat_activity
and pg_terminate_backend
.