[KongchangAI]
ConceptCAS / compare-and-swap

Conditional Update

An atomic database-level operation that uses a WHERE condition to ensure the check and the write complete within the same atomic operation, eliminating the read-then-write time window and enabling lock-free concurrency control.

Timeline (last 90 days)

Oct 19

The conditional update merges the check and the write into the same atomic operation, so there is no time window between read and write; the database engine ensures that only one transaction can hit the condition by locking the target row or via an optimistic-lock version number.

Unverified50%
Oct 19

In PostgreSQL, the correctness of conditional updates (such as UPDATE ... WHERE available >= $1) depends on re-evaluating the WHERE condition under row-level locks (current-read semantics).

Unverified50%
Oct 19

When a conditional update fails, a distinction should be made between "insufficient stock" and "SKU does not exist," as the two have different alerting and retry strategies.

Unverified50%

All Facts (3)

Source Articles