Skip to content
Ameen Abozaid
Planned lessonMID-016-L03

Choosing a locking strategy

  • Lesson 3 of 7
  • Mid-level
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

choose between atomic SQL, optimistic, and pessimistic locking.

Planned topics

  • Low conflict, user edits spanning requests: optimistic.
  • High conflict on a hot row (stock): atomic UPDATE first, otherwise pessimistic.
  • Optimistic under heavy conflict wastes work on retries.
  • Pessimistic holds connections and risks deadlocks; keep it inside one short transaction.
Draft outline details

Demonstration

a decision table: workload / conflict rate / chosen strategy / reason, with product edits, stock decrement, and nightly price job.

Check your understanding

Which strategy for two admins editing a product description?

Show answer

Optimistic, with a 409 on conflict.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.