Closed Eshaan-Lumba closed 7 months ago
Good question!
The short answer is that you're not responsible for what's going on. I meant to take this out of the notes, but apparently the changes never got committed to github on accident.
The long answer is that technically, the command is not blocked, it just takes a very long time to run. For a command to be blocked, that means that it cannot start running until all the relevant locks are released. In this case, however, you are correct that the locks do not conflict, and so the command is not blocked and is allowed to run. The CREATE INDEX CONCURRENTLY command will continue to run, however, until all concurrent transactions are terminated. It is actually performing some subtle work in the background while it is doing this, so it's not technically blocked. The documentation on command covers this in detail, but again you're not responsible for this on the quiz.
In the first set of notes for Transactions and Locks, on problem 27, why Line 4 cause a block? The
CREATE INDEX CONCURRENTLY
command on Line 4 acquires aSHARE UPDATE EXCLUSIVE
lock that, as per the table in the documentation should not get blocked by theROW EXCLUSIVE MODE
command in Line 3.