databasessql
Constraints can protect a database invariant
Anonymous
a unique constraint can prevent duplicate keys even when two requests arrive close together. Application checks can still help shape a useful response, but the database constraint is the part that protects the invariant under concurrent writes.
0