← Quiz: Spring Boot Interview Questions: all 10 questions
Quiz: Spring Boot Interview Questions · Question 7 of 10
When is optimistic locking (a @Version column) a better choice than pessimistic locking?
When is optimistic locking (a @Version column) a better choice than pessimistic locking?
- A.When conflicts happen on almost every update
- B.When the database has no indexes
- C.When conflicts are rare, so locking rows on every read would waste time
- D.Never; pessimistic locking is always better
Answer & explanation
Correct answer: When conflicts are rare, so locking rows on every read would waste time
Optimistic locking detects a conflict at update time instead of blocking readers.
Can you get the rest right without peeking?
Take the timed Quiz: Spring Boot Interview Questions quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →