by dlubarov · 12y ago · 0 comments
Actually schema changes still require exclusive table locks, they're just held very briefly since Postgres doesn't need to rewrite each tuple. (With some exceptions, like adding a NOT NULL column, or reducing the size of a VARCHAR.)
I don't mean to be pedantic, it can be important because the exclusive lock can be blocked by other long-running queries. Then Postgres will try to grant the alter table's exclusive lock before other conflicting locks, so normal reads and writes will be locked out until the long query completes or one of the queries is killed.
Everyone cares about the former, while the latter is of more interest to heavily-loaded sites.
The case you mention of a long-running query is important, so everyone needs to have some idea of their workload at the time.