[{"data":1,"prerenderedAt":123},["ShallowReactive",2],{"term-t\u002Ftransaction":3,"related-t\u002Ftransaction":103},{"id":4,"title":5,"acronym":6,"body":7,"category":83,"description":84,"difficulty":85,"extension":86,"letter":87,"meta":88,"navigation":89,"path":90,"related":91,"seo":97,"sitemap":98,"stem":101,"subcategory":6,"__hash__":102},"terms\u002Fterms\u002Ft\u002Ftransaction.md","Transaction",null,{"type":8,"value":9,"toc":77},"minimark",[10,15,19,23,26,30,66,70,73],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 — The Vibe Check",[16,17,18],"p",{},"A transaction groups multiple database operations into one all-or-nothing bundle. Either ALL of them succeed, or NONE of them happen. Transferring money: subtract from one account AND add to another. If either fails, both are rolled back. No partial disasters.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"A transaction is a unit of work that groups one or more SQL operations into an atomic sequence. Transactions follow ACID properties. They begin with BEGIN (or START TRANSACTION), and end with COMMIT (save changes) or ROLLBACK (undo changes). Savepoints allow partial rollbacks within a transaction.",[11,27,29],{"id":28},"show-me-the-code","Show Me The Code",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","BEGIN;\n  UPDATE accounts SET balance = balance - 100 WHERE id = 1;\n  UPDATE accounts SET balance = balance + 100 WHERE id = 2;\nCOMMIT;  -- or ROLLBACK if something goes wrong\n","sql","",[38,39,40,48,54,60],"code",{"__ignoreMap":36},[41,42,45],"span",{"class":43,"line":44},"line",1,[41,46,47],{},"BEGIN;\n",[41,49,51],{"class":43,"line":50},2,[41,52,53],{},"  UPDATE accounts SET balance = balance - 100 WHERE id = 1;\n",[41,55,57],{"class":43,"line":56},3,[41,58,59],{},"  UPDATE accounts SET balance = balance + 100 WHERE id = 2;\n",[41,61,63],{"class":43,"line":62},4,[41,64,65],{},"COMMIT;  -- or ROLLBACK if something goes wrong\n",[11,67,69],{"id":68},"when-youll-hear-this","When You'll Hear This",[16,71,72],{},"\"Wrap the payment logic in a transaction to prevent partial updates.\" \u002F \"The transaction was rolled back due to a constraint violation.\"",[74,75,76],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":50,"depth":50,"links":78},[79,80,81,82],{"id":13,"depth":50,"text":14},{"id":21,"depth":50,"text":22},{"id":28,"depth":50,"text":29},{"id":68,"depth":50,"text":69},"database","A transaction groups multiple database operations into one all-or-nothing bundle. Either ALL of them succeed, or NONE of them happen.","intermediate","md","t",{},true,"\u002Fterms\u002Ft\u002Ftransaction",[92,93,94,95,96],"ACID","Atomicity","Rollback","Deadlock","Locking",{"title":5,"description":84},{"changefreq":99,"priority":100},"weekly",0.7,"terms\u002Ft\u002Ftransaction","J1CFjmocMZOcEAcAC2zLVC0QPpOusuroqVitood8DDU",[104,108,111,115,119],{"title":92,"path":105,"acronym":106,"category":83,"difficulty":85,"description":107},"\u002Fterms\u002Fa\u002Facid","Atomicity, Consistency, Isolation, Durability","ACID is the four guarantees a reliable database makes about transactions. It is the reason you trust a bank's database with your money.",{"title":93,"path":109,"acronym":6,"category":83,"difficulty":85,"description":110},"\u002Fterms\u002Fa\u002Fatomicity","Atomicity means a transaction is all-or-nothing — like an atom that cannot be split.",{"title":95,"path":112,"acronym":6,"category":113,"difficulty":85,"description":114},"\u002Fterms\u002Fd\u002Fdeadlock","general","A deadlock is when two things are each waiting for the other to go first, and neither ever does. Thread A holds Lock 1 and wants Lock 2.",{"title":96,"path":116,"acronym":6,"category":83,"difficulty":117,"description":118},"\u002Fterms\u002Fl\u002Flocking","advanced","Locking prevents two transactions from modifying the same data at the same time. It is how databases coordinate concurrent access.",{"title":94,"path":120,"acronym":6,"category":113,"difficulty":121,"description":122},"\u002Fterms\u002Fr\u002Frollback","beginner","A rollback is the panic button. When you deploy something and it breaks production, you hit rollback and the system reverts to the last working version — l...",1776518319762]