So I have this big database in production having partitions on date field. I ran this migration to add a new column and its now 1-hour db is stuck not responding and still migrating.

ALTER TABLE public.ur_sms_traffic ADD COLUMN trace_id varchar(16);

The table has no relation. just stand-alone table,

  • 1
    Most likely it's waiting to acquire the needed exclusive lock. Check pg_stat_activity and pg_locks
    – user1822
    Dec 15, 2021 at 9:19

1 Answer 1


I found the issue by checking pg_stat_activity: someone ran a very big query in production and it was holding the migration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.