Postgres Schema Changes and Locking
xata.io
xata.io
Ive telling this to engineers in my org for such a long time, now I also have a nice article to share :)
BTW, you don't need the pg_sleep and hurry with the execution. Simple BEGIN and COMMIT/ROLLBACK will give you infinite wait time :)