{"id":1817,"date":"2023-09-20T18:04:45","date_gmt":"2023-09-20T10:04:45","guid":{"rendered":"https:\/\/white-night.club\/?p=1817"},"modified":"2023-11-09T11:07:53","modified_gmt":"2023-11-09T03:07:53","slug":"db3","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/09\/20\/db3\/","title":{"rendered":"\u6570\u636e\u5e93\u4e8b\u52a1\u7684ACID\u7279\u6027"},"content":{"rendered":"\n<p>\u8bb0\u5f55\u4e0b\u6570\u636e\u5e93\u7cfb\u7edf\u7ef4\u62a4\u4e8b\u52a1\u7684\u56db\u4e2a\u57fa\u672c\u7279\u6027\u3002<\/p>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u4ec0\u4e48\u662f\u4e8b\u52a1\uff1f<\/p>\n<cite><em>\u8bbf\u95ee\u5e76\u80fd\u66f4\u65b0\u5404\u9879\u6570\u636e\u7684\u7a0b\u5e8f\u6267\u884c\u5355\u5143<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u4e8b\u52a1\uff08transaction\uff09\uff0c\u7b80\u5316\u6765\u8bf4\u5c31\u662f\u80fd\u64cd\u4f5c\u6570\u636e\u5e93\u7684\u7a0b\u5e8f\u90fd\u662f\u4e8b\u52a1\u3002\u6bd4\u5982\u67d0\u4e2a\u94f6\u884c\u8981\u8fdb\u884c\u8f6c\u8d26\u64cd\u4f5c\u3002\u7136\u540e\u8be5\u94f6\u884c\u7684\u7a0b\u5e8f\u5458\u5199\u4e86\u4e00\u6bb5\u7528\u4e8e\u7ed9A\u6263\u6b3e+\u7ed9B\u6253\u94b1\u7684SQL\u8bed\u53e5\uff0c\u4e2d\u95f4\u53ef\u80fd\u8fd8\u6709\u67e5\u8be2\u4f59\u989d\u7684SQL\u3002\u8fd9\u6bb5SQL\u65e2\u53ef\u4ee5\u901a\u8fc7navicat\uff0credis insight\u8fd9\u4e9b\u6570\u636e\u5e93\u7684\u7ba1\u7406\u8f6f\u4ef6\u8f93\u5165\uff1b\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7\u547d\u4ee4\u884c\u8f93\u5165\uff1b\u4e5f\u53ef\u4ee5\u901a\u8fc7\u7f16\u5199\u4e2apython\u6216\u8005java\u7a0b\u5e8f\u53bb\u8fde\u63a5\u6570\u636e\u5e93\u3002<\/p>\n\n\n\n<p>\u603b\u7684\u6765\u8bf4\uff0c<mark style=\"background-color:rgba(0, 0, 0, 0);color:#fcb900\" class=\"has-inline-color\">\u4e8b\u52a1\u5c31\u662f\u80fd\u8bbf\u95ee\u5e76\u66f4\u65b0\u6570\u636e\u5e93\u6570\u636e\u7684\u4e00\u4e2a\u7a0b\u5e8f\u6267\u884c\u5355\u5143<\/mark>\u3002\u8be5\u5355\u5143\u7531SQL\uff08\u6216HQL\u7b49DML\u3002\u4f46\u6700\u5177\u6709\u4ee3\u8868\u6027\u7684\u662fSQL\uff09\u6216\u7f16\u7a0b\u8bed\u8a00\uff08C++\uff0cJava\uff09\u7f16\u5199\u7684\u7a0b\u5e8f\u53d1\u8d77\u3002<\/p>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u56db\u79cd\u7279\u6027<\/p>\n<cite><em>\u539f\u5b50\u6027\uff0c\u9694\u79bb\u6027\uff0c\u6301\u4e45\u6027\uff0c\u4e00\u81f4\u6027<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u6211\u4eec\u4e3e\u4e2a\u4ece\u94f6\u884c\u8f6c\u8d26\u7684\u4f8b\u5b50\u3002\u5047\u8bbeA\uff0cB\u94f6\u884c\u8d26\u6237\u90fd\u6709100.<\/p>\n\n\n\n<p>\u73b0\u5728A\u8981\u4ece\u94f6\u884c\u8f6c\u8d26100\u7ed9B\uff0c\u90a3\u9996\u5148\u94f6\u884c\u9700\u8981\u68c0\u67e5A\u7684\u8d26\u6237\u4f59\u989d\uff08\u5047\u8bbe\u521a\u597d\u4e3a100\uff09\u3002\u5982\u679c\u94b1\u591f\u7684\u8bdd\u5148\u4eceA\u8d26\u6237\u4e0a\u6263\u6b3e\uff0c\u518d\u589e\u52a0B\u8d26\u6237\u4e0a\u7684\u94b1\u3002\u6700\u540eA\uff0cB\u518d\u6b21\u67e5\u8be2\u5404\u81ea\u7684\u94f6\u884c\u8d26\u6237\u4f59\u989d\u3002<\/p>\n\n\n\n<p>\u90a3\u4e48\u8be5\u8fc7\u7a0b\u6709\u53ef\u80fd\u4f1a\u51fa\u73b0\u4ee5\u4e0b\u51e0\u4e2a\u95ee\u9898\uff1a<\/p>\n\n\n\n<ul>\n<li>A\u8d26\u6237\u6263\u6b3e\u540e\uff0c\u94f6\u884c\u7cfb\u7edf\u5d29\u6e83\u3002\u90a3\u4e48\u6570\u636e\u5e93\u5728\u7cfb\u7edf\u5d29\u6e83\u540e\u5982\u4f55\u624d\u80fd\u201c\u8bb0\u5f97\u201d\u8fd9\u7b14\u94b1\u662f\u8c01\u7684\uff1fB\u8d26\u6237\u8fd8\u80fd\u6536\u5230\u94b1\u5417\uff1fA\u8d26\u6237\u7684\u94b1\u8981\u9000\u56de\u5417\uff1f<\/li>\n\n\n\n<li>\u5728\u201dA\u8d26\u6237\u6263\u6b3e\u201c\u548c\u201d\u52a0\u6b3e\u91d1\u989d\u5199\u5165B\u8d26\u6237\u201c\u4e4b\u95f4\uff0c\u5f88\u660e\u663e\u662f\u6709\u95f4\u9694\u7684\u3002\u6b64\u65f6\u6570\u636e\u5e93\u6682\u65f6\u4e0d\u4e00\u81f4\uff08\u56e0\u4e3a\u6263\u6b3e\u548c\u52a0\u6b3e\u4e0d\u4e00\u81f4\uff09\u3002\u7531\u4e8e\u6570\u636e\u5e93\u4e3a\u4e86\u6539\u5584\u6027\u80fd\uff0c\u4f7f\u4e8b\u52a1\u53ef\u4ee5\u5e76\u53d1\u6267\u884c\u3002\u5982\u679c\u6b64\u65f6\u94f6\u884c\u60f3\u8bfb\u53d6A\u548cB\u7684\u603b\u8d26\u6237\u4f59\u989d\uff0c\u5373\u51fa\u73b0\u4e86\u7b2c\u4e8c\u4e2a\u4e8b\u52a1\u201dA+B\u201c\uff0c\u90a3\u4e48<mark style=\"background-color:rgba(0, 0, 0, 0);color:#fcb900\" class=\"has-inline-color\">\u5728\u8fd9\u4e2a\u95f4\u9694\u5148\u540e\u4f1a\u5f97\u5230\u4e24\u4e2a\u4e0d\u540c\u7684\u503c<\/mark>\u3002<br><\/li>\n<\/ul>\n\n\n\n<p>\u7b2c\u4e00\u6761\u6d89\u53ca\u5230\u4e86\u539f\u5b50\u6027(atomicity)\uff0c\u4e00\u81f4\u6027(consistency)\uff0c\u6301\u4e45\u6027(durability)\u3002<\/p>\n\n\n\n<ul>\n<li>\u539f\u5b50\u6027\uff1a\u8981\u4e48\u5168\u505a\uff0c\u8981\u4e48\u5168\u4e0d\u505a\u3002\u5982\u679cA\u8d26\u6237\u6263\u6b3e\uff0c\u90a3B\u8d26\u6237\u5c31\u4e00\u5b9a\u8981\u6709\u52a0\u6b3e\u3002\u4e0d\u7136\u56de\u6eda\u64cd\u4f5c\u6216\u6062\u590d\u65e7\u503c\uff0c\u8ba9\u8be5\u4e8b\u52a1\u770b\u8d77\u6765\u4ece\u6765\u6ca1\u6709\u6267\u884c\u8fc7\u3002<\/li>\n\n\n\n<li>\u4e00\u81f4\u6027\uff1a\u4e8b\u52a1\u4e0d\u5e94\u6539\u53d8A+B\u7684\u603b\u548c\u3002\u5728\u8f6c\u8d26\u8fd9\u4e2a\u4e8b\u52a1\u53d1\u751f\u524dA+B\u662f200\uff0c\u90a3\u4e8b\u52a1\u53d1\u751f\u540eA+B\u7684\u503c\u8fd8\u662f200.\uff08\u867d\u7136\u5728\u8f6c\u8d26\u6267\u884c\u7684\u8fc7\u7a0b\u4e2d\uff0c<mark style=\"background-color:rgba(0, 0, 0, 0);color:#fcb900\" class=\"has-inline-color\">\u5fc5\u7136\u4f1a\u51fa\u73b0\u4e0d\u4e00\u81f4\u7684\u60c5\u51b5<\/mark>\uff08\u5373\u4e0d\u4e00\u81f4\u72b6\u6001(inconsistent state))\uff0c\u4f46\u6700\u7ec8\u5f53\u4e8b\u52a1\u6267\u884c\u5b8c\u540e\uff0c\u8fd9\u4e2a<mark style=\"background-color:rgba(0, 0, 0, 0);color:#fcb900\" class=\"has-inline-color\">\u4e0d\u4e00\u81f4\u72b6\u6001\u4f1a\u88ab\u4e00\u81f4\u6027\u72b6\u6001\u53d6\u4ee3<\/mark>)\u3002<\/li>\n\n\n\n<li>\u6301\u4e45\u6027\uff1a\u8f6c\u8d26\u5b8c\u6210\u540e\uff0c\u5373\u4f7f\u6570\u636e\u5e93\u7cfb\u7edf\u5d29\u6e83\uff0c\u6570\u636e\u5e93\u4e5f\u80fd\u201c\u8bb0\u4f4f\u201d\u8fd9\u6b21\u4e8b\u52a1\u5bf9\u6570\u636e\u5e93\u7684\u64cd\u4f5c\u3002\u4e0d\u7136\u8fd9\u6b21\u4e8b\u52a1\u6210\u529f\u6267\u884c\u4e5f\u6ca1\u610f\u4e49\u3002\uff08\u5c31\u50cf\u8001\u677f\u7ed9\u4f60\u53d1\u5de5\u8d44\uff0c\u94f6\u884c\u7cfb\u7edf\u5d29\u6e83\u628a\u4f60\u5de5\u8d44\u56de\u6536\u7ed9\u8001\u677f\u4e86\u3002\uff09<\/li>\n<\/ul>\n\n\n\n<p>\u7b2c\u4e8c\u6761\u5219\u6d89\u53ca\u5230\u4e86\u9694\u79bb\u6027\u3002\u5f88\u660e\u663e\uff0c\u8fd9\u662f\u7531\u201d\u6570\u636e\u5e93\u5e76\u53d1\u6267\u884c\u201c\u5bfc\u81f4\u7684\u95ee\u9898\u3002\u5f53\u7136\uff0c\u6539\u6210\u4e32\u884c\u6267\u884c\uff0c\u5148\u6267\u884c\u7b2c\u4e00\u4e2a\u518d\u6267\u884c\u7b2c\u4e8c\u4e2a\u4e5f\u884c\u3002\u4f46\u5e76\u53d1\u548c\u4e32\u884c\u76f8\u6bd4\uff0c\u5f88\u660e\u663e\u524d\u8005\u80fd\u5927\u5e45\u6539\u5584\u6570\u636e\u5e93\u7684\u6027\u80fd\u3002\u6240\u4ee5\u6211\u4eec\u5f15\u5165\u4e86\u5e76\u53d1\u63a7\u5236\u7cfb\u7edf(concurrency-control system)\u3002\u8fd9\u4e2a\u5c31\u4ee5\u540e\u5b66\u5230\u518d\u8bb0\u5f55\u4e86\u3002<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u5b50\u6027\uff0c\u4e00\u81f4\u6027\uff0c\u9694\u79bb\u6027\uff0c\u6301\u4e45\u6027<\/p>\n","protected":false},"author":1,"featured_media":3123,"comment_status":"open","ping_status":"","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[35,76],"tags":[80],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/1817"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=1817"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/1817\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/3123"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=1817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=1817"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=1817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}