Suppose steps below:
1. begin TX1
2. in TX1, do
update table1 set a =
1;
3. begin TX2
4. in TX2, do
select * from table1 for update
nowait;
Since TX1 is holding a lock, so TX2 failed to acquire a lock.
Then the "select * from table1 for update nowait" will return with an error. I called it "noblocking mode"
On the
other side, if in step 4 do
select * from table1 for update
instead. the
TX2 will keep waiting until TX1 committed or rollbacked, then acquire the lock,
then return successfully. I called it "blocking mode"