What is optimistic locking?

What is optimistic locking?

Approach: Explain versioning and check before commit.

A strategy where multiple transactions can complete without interfering with each other. Before committing, each transaction checks if another has modified the data it read.

Follow-up: When is optimistic locking better than pessimistic locking?

Key concepts: version column, concurrency control.