The problem arises due to the presence of two concurrency control models, which are sometimes mixed with the SQL implementation.
- blocking, as in 2PL (two-phase blocking)
- as in MVCC (Multiversion concurrency Control)
Pessimistic means that read lines are blocked. Optimistic means that the lines that are counted are not locked.
The classic 2PL Repeatable Read implementation is always pessimistic. The multi-version of Repeatable Read is optimistic. It does not block the lines that are read for the SELECT statement, and allows other transactions to change the lines that were read in the SELECT. Such changes are not visible to the transaction that performed the SELECT until it is completed.
fredt
source share