Skip to catalogue

269

transaction isolation

also read committed, repeatable read, serializable

The default isolation level is not “as if one at a time.” Serializable can fail, and you retry.

What is transaction isolation?

Isolation is what a transaction is allowed to observe of other transactions. Read committed lets the same query see different rows a moment later. Repeatable read does not mean the same thing on Postgres and MySQL. Serializable is the level that means one-at-a-time, and the database may abort you with a serialization error you must retry. Phantoms and lost updates live in the gap.

Why does transaction isolation matter when vibe coding?

The draft begins a transaction, reads a balance, calls another service, then writes. It assumed the read was stable. Under the default level it was not, and the HTTP call held a connection the whole time.

How do you do transaction isolation?

Name the anomaly you cannot allow. Pick the level that forbids it. Retry serialization failures. Keep the transaction short. Do not call the network while it is open.

How do you ask a model for transaction isolation?

Run (operation) in a transaction at (isolation level). Retry if the database reports a serialization failure. Do not hold the transaction open across an HTTP call. Do not assume the default level is serializable.

What goes wrong with transaction isolation?

Catching the serialization error and returning 500. The correct response is to retry the transaction a bounded number of times.

adjacent