Backend development

Stage 2 · Lesson 7 of 10

Transactions and ACID

Relational databases and SQL

A groups several statements so they all succeed or all fail together. Moving money between accounts is two updates: take it from one, add it to the other. Without BEGIN and COMMIT, a crash between them loses money.

ACID names the four guarantees. Atomic means all or nothing. Consistent means your constraints still hold.

Isolated means transactions running at the same time do not see each other's half-done work. Durable means committed data survives a crash. Keep transactions short.

Never wait on a network call or a user inside one, because locks are held until it ends. Frameworks usually open one per request or per unit of work.

Common trapreading a value, deciding in code and then writing: another request can change the row in between.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

Practise

Also worth your time

Mark this stage as not done?