{"id":506,"date":"2026-05-17T07:03:55","date_gmt":"2026-05-16T23:03:55","guid":{"rendered":"https:\/\/junai.ai\/blog\/pg-transaction-14\/"},"modified":"2026-05-17T07:03:55","modified_gmt":"2026-05-16T23:03:55","slug":"pg-transaction-14","status":"publish","type":"post","link":"https:\/\/junai.ai\/blog\/pg-transaction-14\/","title":{"rendered":"\ud2b8\ub79c\uc7ad\uc158 \u2014 BEGIN\u00b7COMMIT\u00b7ROLLBACK (\uc911\uae09 14\ud3b8)"},"content":{"rendered":"\n<!-- WordPress REST API \ubc1c\ud589\uc6a9 HTML (\uc790\ub3d9 \uc0dd\uc131) -->\n<!-- WP-FEATURED-MEDIA-ID: 296 -->\n<div style=\"max-width:800px;margin:0 auto;\">\n<style>\n:root{--color-primary:#336791;--color-accent:#60a5fa;--color-bg:#fafafa;--color-bg-card:#ffffff;--color-text:#1e293b;--color-text-muted:#64748b;--hero-start:#0f172a;--hero-end:#336791;--font-body:-apple-system,BlinkMacSystemFont,'Apple SD Gothic Neo','Noto Sans KR',sans-serif;--size-body:17px;--line-height:1.75;}\n*{box-sizing:border-box;}\n.container{max-width:760px;margin:0 auto;padding:0 22px 80px;}\n.hero{background:linear-gradient(135deg,var(--hero-start) 0%,var(--hero-end) 100%);color:#fff;padding:72px 22px 56px;text-align:center;}\n.hero .badge{display:inline-block;background:rgba(96,165,250,0.18);color:var(--color-accent);padding:6px 14px;border-radius:999px;font-size:13px;font-weight:600;letter-spacing:0.5px;margin-bottom:18px;}\n.hero h1{margin:0 0 18px;font-size:36px;line-height:1.3;letter-spacing:-0.3px;}\n.hero p.sub{margin:0 auto;max-width:580px;font-size:17px;color:#bfdbfe;}\n.hero img{width:100%;max-width:720px;height:auto;margin:36px auto 0;display:block;border-radius:10px;box-shadow:0 8px 32px rgba(0,0,0,0.3);}\n.meta{display:flex;gap:14px;justify-content:center;margin-top:20px;font-size:13px;color:#93c5fd;flex-wrap:wrap;}\n.meta span::before{content:\"\u00b7\";margin-right:14px;color:#1e3a8a;}\n.meta span:first-child::before{content:\"\";margin:0;}\narticle{background:var(--color-bg-card);margin-top:-36px;padding:44px 28px;border-radius:14px;box-shadow:0 2px 18px rgba(0,0,0,0.06);}\narticle p{margin:0 0 18px;}\nh2{font-size:28px;line-height:1.35;letter-spacing:-0.3px;margin:48px 0 18px;padding-bottom:10px;border-bottom:2px solid var(--color-primary);}\nh2:first-of-type{margin-top:8px;}\nh3{font-size:21px;line-height:1.4;margin:30px 0 12px;color:var(--color-primary);}\ncode{background:#f1f5f9;color:#0f172a;padding:2px 6px;border-radius:4px;font-family:'SFMono-Regular',Menlo,Consolas,monospace;font-size:0.92em;}\npre{background:#0f172a;color:#e2e8f0;padding:18px 20px;border-radius:10px;overflow-x:auto;font-size:14.5px;line-height:1.65;margin:18px 0;}\npre code{background:transparent;color:inherit;padding:0;}\nul,ol{margin:0 0 18px;padding-left:24px;}\nli{margin-bottom:8px;}\nstrong{color:#0f172a;}\n.databox{background:#eff6ff;border-left:4px solid var(--color-primary);padding:18px 20px;border-radius:6px;margin:22px 0;}\n.databox p{margin:0 0 8px;}\n.databox p:last-child{margin:0;}\n.databox strong{color:var(--color-primary);}\n.warnbox{background:linear-gradient(135deg,#fef3c7 0%,#fde68a 100%);border-left:4px solid #d97706;padding:18px 20px;border-radius:6px;margin:22px 0;}\n.warnbox strong{color:#92400e;}\n.tablewrap{overflow-x:auto;-webkit-overflow-scrolling:touch;margin:22px 0;}\ntable{width:100%;border-collapse:collapse;font-size:15px;background:var(--color-bg-card);}\nth,td{padding:11px 12px;text-align:left;border-bottom:1px solid #e2e8f0;vertical-align:top;}\nth{background:#f1f5f9;font-weight:700;color:#0f172a;}\ntd:first-child,th:first-child{font-weight:700;}\n.cta{background:linear-gradient(135deg,#336791 0%,#60a5fa 100%);color:#fff;padding:30px 24px;border-radius:12px;margin-top:44px;text-align:center;}\n.cta h3{color:#fff;margin:0 0 10px;}\n.cta p{margin:0;color:#dbeafe;}\n.series-nav{background:#eff6ff;padding:18px 22px;border-radius:10px;margin-top:24px;font-size:14.5px;color:var(--color-text-muted);}\n.series-nav strong{color:var(--color-primary);}\n@media (max-width:480px){.hero{padding:52px 18px 44px;}.hero h1{font-size:26px;}.hero p.sub{font-size:15px;}article{padding:28px 18px;border-radius:10px;}h2{font-size:22px;}h3{font-size:18px;}body{font-size:16px;}pre{font-size:13px;padding:14px 16px;}}\n@media (max-width:560px){.tablewrap table,.tablewrap thead,.tablewrap tbody,.tablewrap tr,.tablewrap th,.tablewrap td{display:block;width:auto;}.tablewrap thead{display:none;}.tablewrap tr{margin:0 0 14px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden;}.tablewrap td{border:none;border-bottom:1px solid #f1f5f9;padding:9px 14px;}.tablewrap td:first-child{background:#eff6ff;font-weight:800;font-size:15.5px;}.tablewrap td:last-child{border-bottom:none;}.tablewrap td[data-label]::before{content:attr(data-label) \" \u2014 \";font-weight:700;color:var(--color-primary);}}\n<\/style>\n<header class=\"hero\">\n  <span class=\"badge\">PostgreSQL \uad50\uc7ac \u00b7 14\ud3b8 \/ 24\ud3b8<\/span>\n  <h1>\ud2b8\ub79c\uc7ad\uc158 \u2014 BEGIN\u00b7COMMIT\u00b7ROLLBACK<\/h1>\n  <p class=\"sub\">&#8220;\uc804\ubd80 \ub418\uac70\ub098, \uc804\ud600 \uc548 \ub418\uac70\ub098&#8221; \u2014 DB \uc758 \uac00\uc7a5 \uc911\uc694\ud55c \uc57d\uc18d.<\/p>\n  <div class=\"meta\"><span>\uc911\uae09<\/span><span>\uc77d\ub294 \uc2dc\uac04 8\ubd84<\/span><span>2026-05-17<\/span><\/div>\n  <img decoding=\"async\" src=\"https:\/\/junai.ai\/blog\/wp-content\/uploads\/2026\/05\/hero-75.jpg\" alt=\"BEGIN-COMMIT \uc0ac\uc774\uc758 \ud2b8\ub79c\uc7ad\uc158 \ud750\ub984\uc774 \ub2e4\uc774\uc5b4\uadf8\ub7a8\uc73c\ub85c \ud45c\ud604\ub41c \uc77c\ub7ec\uc2a4\ud2b8\">\n<\/header>\n\n<div class=\"container\">\n<article>\n\n<p>\uc911\uae09 \ud30c\ud2b8\uc758 \uc2dc\uc791. \ud2b8\ub79c\uc7ad\uc158\uc740 DB \uac00 &#8220;\uc5ec\ub7ec SQL \uc744 \ud55c \ubb36\uc74c\uc73c\ub85c&#8221; \ub2e4\ub8e8\ub294 \uc57d\uc18d\uc785\ub2c8\ub2e4. \uacc4\uc88c \uc774\uccb4\uac00 \uc808\ubc18\ub9cc \ub418\uba74 \ud070\uc77c\uc774\uc8e0 \u2014 \uadf8\uac78 \ub9c9\uc544\uc8fc\ub294 \uac8c \ud2b8\ub79c\uc7ad\uc158. 14\ud3b8\uc740 ACID \uc758 \uc758\ubbf8, BEGIN\/COMMIT\/ROLLBACK, savepoint, \uadf8\ub9ac\uace0 4\uac00\uc9c0 \uaca9\ub9ac \uc218\uc900\uc758 \ucc28\uc774\uae4c\uc9c0.<\/p>\n\n<h2>\uc65c \ud2b8\ub79c\uc7ad\uc158\uc774 \ud544\uc694\ud55c\uac00<\/h2>\n\n<pre><code>-- A \u2192 B \ub85c 10000\uc6d0 \uc774\uccb4\nUPDATE accounts SET balance = balance - 10000 WHERE id = 'A';\n-- (\uc5ec\uae30\uc11c \uc2dc\uc2a4\ud15c \uc8fd\uc73c\uba74? A \ub9cc \ucc28\uac10\ub418\uace0 B \ub294 \uc548 \ubc1b\uc74c \u2014 1\ub9cc\uc6d0\uc774 \uc0ac\ub77c\uc9d0)\nUPDATE accounts SET balance = balance + 10000 WHERE id = 'B';\n\n-- \ud2b8\ub79c\uc7ad\uc158\uc73c\ub85c \ubb36\uae30 \u2014 \ub458 \ub2e4 \ub418\uac70\ub098 \ub458 \ub2e4 \uc548 \ub418\uac70\ub098\nBEGIN;\n  UPDATE accounts SET balance = balance - 10000 WHERE id = 'A';\n  UPDATE accounts SET balance = balance + 10000 WHERE id = 'B';\nCOMMIT;\n-- \uc911\uac04\uc5d0 \uc8fd\uc5b4\ub3c4 ROLLBACK \ucc98\ub9ac\ub428<\/code><\/pre>\n\n<h2>ACID \u2014 \ud2b8\ub79c\uc7ad\uc158\uc758 4\uac00\uc9c0 \uc57d\uc18d<\/h2>\n\n<div class=\"tablewrap\">\n<table>\n  <thead>\n    <tr><th>\uc57d\uc790<\/th><th>\uc758\ubbf8<\/th><th>\uc608\uc2dc<\/th><\/tr>\n  <\/thead>\n  <tbody>\n    <tr><td data-label=\"\">A \u2014 Atomicity<\/td><td data-label=\"\">\uc804\uccb4\uac00 \ub418\uac70\ub098 \uc804\ud600 \uc548 \ub428<\/td><td data-label=\"\">\uc704 \uc774\uccb4 \uc608\uc2dc<\/td><\/tr>\n    <tr><td data-label=\"\">C \u2014 Consistency<\/td><td data-label=\"\">\uc81c\uc57d\uc744 \ud56d\uc0c1 \ub9cc\uc871<\/td><td data-label=\"\">CHECK\u00b7FK \uc704\ubc18\uc740 ROLLBACK<\/td><\/tr>\n    <tr><td data-label=\"\">I \u2014 Isolation<\/td><td data-label=\"\">\ub3d9\uc2dc \ud2b8\ub79c\uc7ad\uc158\ub07c\ub9ac \uaca9\ub9ac<\/td><td data-label=\"\">4\uac00\uc9c0 \uc218\uc900 (\uc544\ub798)<\/td><\/tr>\n    <tr><td data-label=\"\">D \u2014 Durability<\/td><td data-label=\"\">COMMIT \ud6c4 \uc190\uc2e4 \uc5c6\uc74c<\/td><td data-label=\"\">WAL \ub514\uc2a4\ud06c \uae30\ub85d<\/td><\/tr>\n  <\/tbody>\n<\/table>\n<\/div>\n\n<h2>BEGIN \u00b7 COMMIT \u00b7 ROLLBACK \uae30\ubcf8<\/h2>\n\n<pre><code>BEGIN;                              -- \ub610\ub294 BEGIN TRANSACTION;\n  INSERT INTO orders (...) VALUES (...);\n  INSERT INTO order_items (...) VALUES (...);\n  UPDATE inventory SET stock = stock - 1 WHERE id = 5;\nCOMMIT;                             -- \ud655\uc815\n\n-- \ub610\ub294\nBEGIN;\n  DELETE FROM users WHERE active = false;\n  -- \uc601\ud5a5 \ud589 \uc218 \ud655\uc778\n  -- \"\uc608\uc0c1\ubcf4\ub2e4 \ub9ce\ub124\"\nROLLBACK;                           -- \ucde8\uc18c (\uc544\ubb34 \uc77c \uc5c6\uc5c8\ub358 \uac83\ucc98\ub7fc)<\/code><\/pre>\n\n<div class=\"databox\">\n  <p><strong>&#8220;\uc790\ub3d9 \ud2b8\ub79c\uc7ad\uc158&#8221; \ud568\uc815.<\/strong> \ud55c \uc904 SQL \ub3c4 \uc0ac\uc2e4 \uc790\ub3d9 \ud2b8\ub79c\uc7ad\uc158\uc785\ub2c8\ub2e4 \u2014 psql \uc5d0\uc11c <code>UPDATE<\/code> \uce5c \uc989\uc2dc COMMIT \ub428. \uc5ec\ub7ec \uc904\uc744 \ubb36\uace0 \uc2f6\uc73c\uba74 \uba85\uc2dc\uc801\uc73c\ub85c <code>BEGIN ... COMMIT<\/code>. \uc548\uc5d0\uc11c \uc5d0\ub7ec \ub098\uba74 \ud2b8\ub79c\uc7ad\uc158\uc774 <strong>aborted<\/strong> \uc0c1\ud0dc\uac00 \ub418\uc5b4, \ub2e4\uc74c \uba85\ub839\uc774 \ub2e4 \uac70\ubd80\ub428 \u2192 ROLLBACK \uc73c\ub85c \ud480\uc5b4\uc57c \ud568.<\/p>\n<\/div>\n\n<h2>SAVEPOINT \u2014 \ubd80\ubd84 ROLLBACK<\/h2>\n\n<pre><code>BEGIN;\n  INSERT INTO orders (...) VALUES (...);\n\n  SAVEPOINT before_items;\n    INSERT INTO order_items (...) VALUES (...);\n    -- \uc5d0\ub7ec \ubc1c\uc0dd \u2192 \uc5ec\uae30\uae4c\uc9c0\ub9cc \ucde8\uc18c\ud558\uace0 \uc2f6\uc744 \ub54c\n  ROLLBACK TO SAVEPOINT before_items;\n\n  -- orders INSERT \ub294 \uadf8\ub300\ub85c \uc0b4\uc544\uc788\uc74c\n  INSERT INTO order_items (...) VALUES (...);   -- \ub2e4\uc2dc \uc2dc\ub3c4\nCOMMIT;<\/code><\/pre>\n\n<p>\uc911\uac04 \uccb4\ud06c\ud3ec\uc778\ud2b8. \uc5ec\ub7ec \ub2e8\uacc4 \ud2b8\ub79c\uc7ad\uc158\uc5d0\uc11c \uc77c\ubd80\ub9cc \ub418\ub3cc\ub9ac\uace0 \uc2f6\uc744 \ub54c \uc720\uc6a9 \u2014 ORM \uc758 nested transaction \ub3c4 \ub300\ubd80\ubd84 SAVEPOINT \ub85c \uad6c\ud604.<\/p>\n\n<h2>\uaca9\ub9ac \uc218\uc900 4\uc885 \u2014 \uc5b4\ub5a4 \ub3d9\uc2dc\uc131 \uc774\uc0c1\uc744 \ub9c9\uc744\uae4c<\/h2>\n\n<div class=\"tablewrap\">\n<table>\n  <thead>\n    <tr><th>\uc218\uc900<\/th><th>dirty read<\/th><th>non-repeatable read<\/th><th>phantom read<\/th><\/tr>\n  <\/thead>\n  <tbody>\n    <tr><td data-label=\"\uc218\uc900\">Read Uncommitted<\/td><td data-label=\"d\">\uac00\ub2a5<\/td><td data-label=\"nr\">\uac00\ub2a5<\/td><td data-label=\"p\">\uac00\ub2a5<\/td><\/tr>\n    <tr><td data-label=\"\uc218\uc900\">Read Committed \u2605\uae30\ubcf8<\/td><td data-label=\"d\">\ucc28\ub2e8<\/td><td data-label=\"nr\">\uac00\ub2a5<\/td><td data-label=\"p\">\uac00\ub2a5<\/td><\/tr>\n    <tr><td data-label=\"\uc218\uc900\">Repeatable Read<\/td><td data-label=\"d\">\ucc28\ub2e8<\/td><td data-label=\"nr\">\ucc28\ub2e8<\/td><td data-label=\"p\">PG \ub294 \ucc28\ub2e8<\/td><\/tr>\n    <tr><td data-label=\"\uc218\uc900\">Serializable<\/td><td data-label=\"d\">\ucc28\ub2e8<\/td><td data-label=\"nr\">\ucc28\ub2e8<\/td><td data-label=\"p\">\ucc28\ub2e8 (\uc9c1\ub82c\ud654)<\/td><\/tr>\n  <\/tbody>\n<\/table>\n<\/div>\n\n<div class=\"databox\">\n  <p><strong>\uac01 \uc774\uc0c1\uc758 \uc758\ubbf8.<\/strong><\/p>\n  <p>\u00b7 <strong>dirty read<\/strong> \u2014 \ub2e4\ub978 TX \uc758 COMMIT \uc548 \ub41c \ubcc0\uacbd\uc744 \ubd04 (PG \ub294 \uc790\ub3d9 \ucc28\ub2e8).<\/p>\n  <p>\u00b7 <strong>non-repeatable read<\/strong> \u2014 \uac19\uc740 \ud589\uc744 \ud55c TX \uc548\uc5d0\uc11c \ub450 \ubc88 \uc77d\uc5c8\ub294\ub370 \ub2e4\ub984.<\/p>\n  <p>\u00b7 <strong>phantom read<\/strong> \u2014 \uac19\uc740 WHERE \ub85c \ub450 \ubc88 SELECT \ud588\ub294\ub370 \ud589 \uac1c\uc218\uac00 \ub2e4\ub984.<\/p>\n<\/div>\n\n<pre><code>-- \uaca9\ub9ac \uc218\uc900 \uc124\uc815 (\ud2b8\ub79c\uc7ad\uc158 \ub2e8\uc704)\nBEGIN ISOLATION LEVEL REPEATABLE READ;\n  SELECT balance FROM accounts WHERE id = 'A';\n  -- \ub2e4\ub978 \ud2b8\ub79c\uc7ad\uc158\uc774 balance \ubc14\uafd4\ub3c4 \uc774 TX \uc5d0\uc11c\ub294 \ucc98\uc74c \uac12 \uadf8\ub300\ub85c\n  SELECT balance FROM accounts WHERE id = 'A';   -- \uac19\uc740 \uac12\nCOMMIT;\n\n-- \uc138\uc158 \uae30\ubcf8\uac12\nSET default_transaction_isolation = 'repeatable read';<\/code><\/pre>\n\n<h2>Read Committed vs Repeatable Read \u2014 \uac00\uc7a5 \uc790\uc8fc \uc120\ud0dd<\/h2>\n\n<p>PG \uc758 <strong>\uae30\ubcf8\uc740 Read Committed<\/strong>. \ud55c TX \uc548\uc5d0\uc11c\ub3c4 \ub9e4 SELECT \uac00 \uadf8 \uc2dc\uc810\uc758 \ucd5c\uc2e0 commit \uc744 \ubd04. \uac00\ubcbc\uc6b4 OLTP \uc5d0 \uc801\ud569.<\/p>\n\n<p><strong>Repeatable Read<\/strong> \ub294 TX \uc2dc\uc791 \uc2dc\uc810\uc758 \uc2a4\ub0c5\uc0f7\uc744 \ub05d\uae4c\uc9c0 \uc0ac\uc6a9. \ubcf4\uace0\uc11c \uc0dd\uc131\u00b7\uc77c\uad00\ub41c \ubd84\uc11d\uc5d0 \uc720\uc6a9. \ub2e8 \ub2e4\ub978 TX \uac00 \uac19\uc740 \ud589\uc744 \ubc14\uafb8\uba74 <strong>&#8220;serialization failure&#8221;<\/strong> \uac00 \ub098\uc11c \uc7ac\uc2dc\ub3c4\ud574\uc57c \ud569\ub2c8\ub2e4.<\/p>\n\n<pre><code>-- Repeatable Read \uc5d0\uc11c \ud754\ud55c \ud328\ud134\nBEGIN ISOLATION LEVEL REPEATABLE READ;\n  -- ... \uc5ec\ub7ec SELECT \uc640 \uc77c\uad00\uc131 \uac80\uc99d ...\nCOMMIT;\n-- \ub9cc\uc57d ERROR: could not serialize access\n-- \u2192 \ud2b8\ub79c\uc7ad\uc158 \uc804\uccb4\ub97c \ub2e4\uc2dc \uc2dc\ub3c4<\/code><\/pre>\n\n<h2>Serializable \u2014 \uc9c4\uc9dc \uc9c1\ub82c\ud654 \ud658\uc0c1<\/h2>\n\n<pre><code>BEGIN ISOLATION LEVEL SERIALIZABLE;\n  -- \ub3d9\uc2dc\uc5d0 \ub3c4\ub294 \ub2e4\ub978 SERIALIZABLE TX \uc640 \ucda9\ub3cc\uc774 \uac10\uc9c0\ub418\uba74 abort\n  -- \ucda9\ub3cc\uc774 \uc5c6\uc73c\uba74 \ub9c8\uce58 \ud63c\uc790\ub9cc \ub3c4\ub294 \uac83\ucc98\ub7fc \ub3d9\uc791 \ubcf4\uc7a5\nCOMMIT;<\/code><\/pre>\n\n<p>\uac00\uc7a5 \uac15\ud55c \uaca9\ub9ac. PG \uc758 SSI(Serializable Snapshot Isolation) \uac00 \uad6c\ud604 \u2014 \uc131\ub2a5\uc740 Repeatable Read \uc640 \ube44\uc2b7\ud558\ub098 abort \uac00 \ub354 \uc790\uc8fc. \uac15\ud55c \uc77c\uad00\uc131\uc774 \ud544\uc218\uc778 \uacb0\uc81c\u00b7\uc7ac\uace0 \uac19\uc740 \uc601\uc5ed\uc5d0 \uc0ac\uc6a9.<\/p>\n\n<h2>\uc2e4\uc804 \ud328\ud134 1 \u2014 \ub77d \ucda9\ub3cc \ud68c\ud53c (FOR UPDATE)<\/h2>\n\n<pre><code>-- \uc7ac\uace0 \ud655\uc778 + \ucc28\uac10\uc744 \uc548\uc804\ud558\uac8c\nBEGIN;\n  SELECT stock FROM inventory WHERE id = 5 FOR UPDATE;   -- \ud589 \ub77d\n  -- (\ub2e4\ub978 TX \ub294 \uc774 \ud589\uc744 \ubabb \ub9cc\uc9d0)\n  UPDATE inventory SET stock = stock - 1 WHERE id = 5;\nCOMMIT;<\/code><\/pre>\n\n<p>15\ud3b8(\ub77d) \uc5d0\uc11c \uae4a\uc774.<\/p>\n\n<h2>\uc2e4\uc804 \ud328\ud134 2 \u2014 \uc7ac\uc2dc\ub3c4 (\uc11c\ube44\uc2a4 \ucf54\ub4dc)<\/h2>\n\n<pre><code>\/\/ pseudo-code\nasync function transferMoney(from, to, amount) {\n  for (let attempt = 0; attempt &lt; 3; attempt++) {\n    try {\n      await db.tx(async (t) =&gt; {\n        await t.query('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE');\n        await t.query('UPDATE accounts SET balance = balance - $1 WHERE id = $2', [amount, from]);\n        await t.query('UPDATE accounts SET balance = balance + $1 WHERE id = $2', [amount, to]);\n      });\n      return;\n    } catch (err) {\n      if (err.code === '40001') continue; \/\/ serialization failure \u2192 \uc7ac\uc2dc\ub3c4\n      throw err;\n    }\n  }\n  throw new Error('\uc11c\ubc84 \ud63c\uc7a1 \u2014 \ub2e4\uc2dc \uc2dc\ub3c4\ud558\uc138\uc694');\n}<\/code><\/pre>\n\n<h2>\uc548\ud2f0\ud328\ud134 5\uac00\uc9c0<\/h2>\n\n<div class=\"warnbox\">\n  <p><strong>1. BEGIN \ub9cc \ud558\uace0 COMMIT \uc78a\uc74c.<\/strong> \ud2b8\ub79c\uc7ad\uc158\uc774 \ubb34\ud55c\ud788 \uc5f4\ub824 \ub77d\uc774 \uc313\uc784 \u2192 \uc11c\ube44\uc2a4 \uc815\uc9c0.<\/p>\n  <p><strong>2. \ud2b8\ub79c\uc7ad\uc158 \uc548\uc5d0\uc11c \uc678\ubd80 API \ud638\ucd9c.<\/strong> HTTP \uc751\ub2f5 \uae30\ub2e4\ub9ac\ub294 \ub3d9\uc548 DB \ub77d \ubcf4\uc720 \u2192 \ub290\ub824\uc9d0.<\/p>\n  <p><strong>3. \ub108\ubb34 \ud070 \ud2b8\ub79c\uc7ad\uc158.<\/strong> 1\ub9cc \ud589 \ud55c \ubc88\uc5d0 UPDATE \u2014 WAL \ud3ed\uc99d\u00b7\ub77d \uc2dc\uac04 \ud3ed\uc99d. \ubc30\uce58\ub97c \uc798\ub77c\uc11c.<\/p>\n  <p><strong>4. autocommit \uac00\uc815.<\/strong> \ub77c\uc774\ube0c\ub7ec\ub9ac\/\ud480\uc5d0 \ub530\ub77c \ub2e4\ub984. \uba85\uc2dc\uc801\uc73c\ub85c BEGIN\/COMMIT \ub610\ub294 ORM \uc758 transaction() \uc0ac\uc6a9.<\/p>\n  <p><strong>5. ROLLBACK \uc548 \ud568.<\/strong> aborted \uc0c1\ud0dc\uc5d0\uc11c \ub2e4\uc74c \uba85\ub839\uc774 \ub2e4 \uac70\ubd80\ub428 \u2014 catch \uc808\uc5d0\uc11c \uba85\uc2dc\uc801\uc73c\ub85c ROLLBACK.<\/p>\n<\/div>\n\n<div class=\"cta\">\n  <h3>15\ud3b8 \u2014 \ub77d\uacfc \ub3d9\uc2dc\uc131 (FOR UPDATE)<\/h3>\n  <p>\ud589\/\ud14c\uc774\ube14 \ub77d, deadlock \uc9c4\ub2e8, pg_locks\/pg_stat_activity.<\/p>\n<\/div>\n\n<div class=\"series-nav\">\n  <strong>\ud83d\udcda PostgreSQL \ubc30\uc6b0\uae30 \uad50\uc7ac<\/strong><br>\n  \uc774\uc804: 13\ud3b8 \ubdf0 \u00b7 \ud604\uc7ac: <strong>14\ud3b8 (\uc911\uae09 \uc2dc\uc791)<\/strong> \u00b7 \ub2e4\uc74c \u2192 15\ud3b8 \ub77d \u00b7 \uc9c4\ud589: <strong>14\/24<\/strong>\n<\/div>\n\n<\/article>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\ud2b8\ub79c\uc7ad\uc158\u00b7ACID\u00b7\uaca9\ub9ac \uc218\uc900 4\uc885\u00b7savepoint. 24\ud3b8 \uad50\uc7ac 14\ud3b8.<\/p>\n","protected":false},"author":1,"featured_media":296,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-506","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-postgresql"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/junai.ai\/blog\/wp-json\/wp\/v2\/posts\/506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/junai.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/junai.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/junai.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/junai.ai\/blog\/wp-json\/wp\/v2\/comments?post=506"}],"version-history":[{"count":0,"href":"https:\/\/junai.ai\/blog\/wp-json\/wp\/v2\/posts\/506\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/junai.ai\/blog\/wp-json\/wp\/v2\/media\/296"}],"wp:attachment":[{"href":"https:\/\/junai.ai\/blog\/wp-json\/wp\/v2\/media?parent=506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/junai.ai\/blog\/wp-json\/wp\/v2\/categories?post=506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/junai.ai\/blog\/wp-json\/wp\/v2\/tags?post=506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}