{"id":41003,"date":"2020-09-25T23:36:49","date_gmt":"2020-09-25T15:36:49","guid":{"rendered":"http:\/\/www.zhushiyao.com\/?p=41003"},"modified":"2020-09-25T23:38:23","modified_gmt":"2020-09-25T15:38:23","slug":"f01ebd52be","status":"publish","type":"post","link":"http:\/\/www.zhushiyao.com\/?p=41003","title":{"rendered":"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406"},"content":{"rendered":"<div class=\"bpp-post-content\">\n<p style=\"color: #3e3e3e; font-size: 16px; white-space: normal; background-color: #ffffff;\">\u00a0<\/p>\n<section style=\"font-size: 16px; color: black; padding-right: 10px; padding-left: 10px; line-height: 1.6; letter-spacing: 0px; word-break: break-word; text-align: left; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;\">\n<h2 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; border-bottom: 2px solid #ef7060; font-size: 1.3em;\"><span style=\"display: inline-block; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u5f00\u7bc7<\/span><\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u76f8\u4fe1\u5927\u5bb6\u90fd\u7528\u8fc7\u4e8b\u52a1\u4ee5\u53ca\u4e86\u89e3\u4ed6\u7684\u7279\u70b9\uff0c\u5982\u539f\u5b50\u6027(Atomicity),\u4e00\u81f4\u6027(Consistency),\u9694\u79bb\u578b(Isolation)\u4ee5\u53ca\u6301\u4e45\u6027(Durability)\u7b49\u3002\u4eca\u5929\u60f3\u8ddf\u5927\u5bb6\u4e00\u8d77\u7814\u7a76\u4e0b\u4e8b\u52a1\u5185\u90e8\u5230\u5e95\u662f\u600e\u4e48\u5b9e\u73b0\u7684\uff0c\u5728\u8bb2\u89e3\u524d\u6211\u60f3\u5148\u629b\u51fa\u4e2a\u95ee\u9898\uff1a<\/p>\n<blockquote style=\"font-size: 0.9em; overflow: auto; color: #6a737d; padding: 10px 10px 10px 20px; margin-bottom: 20px; margin-top: 20px; border-left-color: #ef7060; background: #fff9f9;\">\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; color: black; line-height: 26px;\">\u4e8b\u52a1\u60f3\u8981\u505a\u5230\u4ec0\u4e48\u6548\u679c\uff1f<\/p>\n<\/blockquote>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u6309\u6211\u7406\u89e3\uff0c\u65e0\u975e\u662f\u8981\u505a\u5230\u53ef\u9760\u6027\u4ee5\u53ca\u5e76\u53d1\u5904\u7406<\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u53ef\u9760\u6027\uff1a\u6570\u636e\u5e93\u8981\u4fdd\u8bc1\u5f53insert\u6216update\u64cd\u4f5c\u65f6\u629b\u5f02\u5e38\u6216\u8005\u6570\u636e\u5e93crash\u7684\u65f6\u5019\u9700\u8981\u4fdd\u969c\u6570\u636e\u7684\u64cd\u4f5c\u524d\u540e\u7684\u4e00\u81f4\uff0c\u60f3\u8981\u505a\u5230\u8fd9\u4e2a\uff0c\u6211\u9700\u8981\u77e5\u9053\u6211\u4fee\u6539\u4e4b\u524d\u548c\u4fee\u6539\u4e4b\u540e\u7684\u72b6\u6001\uff0c\u6240\u4ee5\u5c31\u6709\u4e86undo log\u548credo log\u3002<\/p>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u5e76\u53d1\u5904\u7406\uff1a\u4e5f\u5c31\u662f\u8bf4\u5f53\u591a\u4e2a\u5e76\u53d1\u8bf7\u6c42\u8fc7\u6765\uff0c\u5e76\u4e14\u5176\u4e2d\u6709\u4e00\u4e2a\u8bf7\u6c42\u662f\u5bf9\u6570\u636e\u4fee\u6539\u64cd\u4f5c\u7684\u65f6\u5019\u4f1a\u6709\u5f71\u54cd\uff0c\u4e3a\u4e86\u907f\u514d\u8bfb\u5230\u810f\u6570\u636e\uff0c\u6240\u4ee5\u9700\u8981\u5bf9\u4e8b\u52a1\u4e4b\u95f4\u7684\u8bfb\u5199\u8fdb\u884c\u9694\u79bb\uff0c\u81f3\u4e8e\u9694\u79bb\u5230\u5565\u7a0b\u5ea6\u5f97\u770b\u4e1a\u52a1\u7cfb\u7edf\u7684\u573a\u666f\u4e86\uff0c\u5b9e\u73b0\u8fd9\u4e2a\u5c31\u5f97\u7528MySQL \u7684\u9694\u79bb\u7ea7\u522b\u3002<\/p>\n<\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e0b\u9762\u6211\u9996\u5148\u8bb2\u5b9e\u73b0\u4e8b\u52a1\u529f\u80fd\u7684\u4e09\u4e2a\u6280\u672f\uff0c\u5206\u522b\u662f\u65e5\u5fd7\u6587\u4ef6(redo log \u548c undo log)\uff0c\u9501\u6280\u672f\u4ee5\u53caMVCC\uff0c\u7136\u540e\u518d\u8bb2\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\uff0c\u5305\u62ec\u539f\u5b50\u6027\u662f\u600e\u4e48\u5b9e\u73b0\u7684\uff0c\u9694\u79bb\u578b\u662f\u600e\u4e48\u5b9e\u73b0\u7684\u7b49\u7b49\u3002\u6700\u540e\u5728\u505a\u4e00\u4e2a\u603b\u7ed3\uff0c\u5e0c\u671b\u5927\u5bb6\u80fd\u591f\u8010\u5fc3\u770b\u5b8c<\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">redo log\u4e0eundo log\u4ecb\u7ecd<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">mysql\u9501\u6280\u672f\u4ee5\u53caMVCC\u57fa\u7840<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u603b\u7ed3<\/section>\n<\/li>\n<\/ul>\n<h2 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; border-bottom: 2px solid #ef7060; font-size: 1.3em;\"><span style=\"display: inline-block; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e8c\u3001 redo log \u4e0e undo log\u4ecb\u7ecd<\/span><\/h2>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 20px;\">1. redo log<\/h3>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u4ec0\u4e48\u662fredo log ?<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">redo log\u53eb\u505a\u91cd\u505a\u65e5\u5fd7\uff0c\u662f\u7528\u6765\u5b9e\u73b0\u4e8b\u52a1\u7684\u6301\u4e45\u6027\u3002\u8be5\u65e5\u5fd7\u6587\u4ef6\u7531\u4e24\u90e8\u5206\u7ec4\u6210\uff1a\u91cd\u505a\u65e5\u5fd7\u7f13\u51b2\uff08redo log buffer\uff09\u4ee5\u53ca\u91cd\u505a\u65e5\u5fd7\u6587\u4ef6\uff08redo log\uff09,\u524d\u8005\u662f\u5728\u5185\u5b58\u4e2d\uff0c\u540e\u8005\u5728\u78c1\u76d8\u4e2d\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5f53\u4e8b\u52a1\u63d0\u4ea4\u4e4b\u540e\u4f1a\u628a\u6240\u6709\u4fee\u6539\u4fe1\u606f\u90fd\u4f1a\u5b58\u5230\u8be5\u65e5\u5fd7\u4e2d\u3002\u5047\u8bbe\u6709\u4e2a\u8868\u53eb\u505atb1(id,username) \u73b0\u5728\u8981\u63d2\u5165\u6570\u636e\uff083\uff0cceshi\uff09<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" title=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/09\/9-1601048209.png\" alt=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" \/><\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\">start\u00a0transaction;<br \/>select\u00a0balance\u00a0from\u00a0bank\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">where<\/span>\u00a0name=<span style=\"color: #98c379; line-height: 26px;\">\"zhangsan\"<\/span>;<br \/>\/\/\u00a0\u751f\u6210\u00a0\u91cd\u505a\u65e5\u5fd7\u00a0balance=600<br \/>update\u00a0bank\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">set<\/span>\u00a0balance\u00a0=\u00a0balance\u00a0-\u00a0400;\u00a0<br \/>\/\/\u00a0\u751f\u6210\u00a0\u91cd\u505a\u65e5\u5fd7\u00a0amount=400<br \/>update\u00a0finance\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">set<\/span>\u00a0amount\u00a0=\u00a0amount\u00a0+\u00a0400;<br \/>commit;<br \/><\/code><\/pre>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\"><img decoding=\"async\" title=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/09\/1-1601048209.png\" alt=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" \/><\/h4>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">redo log \u6709\u4ec0\u4e48\u4f5c\u7528\uff1f<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">mysql \u4e3a\u4e86\u63d0\u5347\u6027\u80fd\u4e0d\u4f1a\u628a\u6bcf\u6b21\u7684\u4fee\u6539\u90fd\u5b9e\u65f6\u540c\u6b65\u5230\u78c1\u76d8\uff0c\u800c\u662f\u4f1a\u5148\u5b58\u5230Boffer Pool(\u7f13\u51b2\u6c60)\u91cc\u5934\uff0c\u628a\u8fd9\u4e2a\u5f53\u4f5c\u7f13\u5b58\u6765\u7528\u3002\u7136\u540e\u4f7f\u7528\u540e\u53f0\u7ebf\u7a0b\u53bb\u505a\u7f13\u51b2\u6c60\u548c\u78c1\u76d8\u4e4b\u95f4\u7684\u540c\u6b65\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u90a3\u4e48\u95ee\u9898\u6765\u4e86\uff0c\u5982\u679c\u8fd8\u6ca1\u6765\u7684\u540c\u6b65\u7684\u65f6\u5019\u5b95\u673a\u6216\u65ad\u7535\u4e86\u600e\u4e48\u529e\uff1f\u8fd8\u6ca1\u6765\u5f97\u53ca\u6267\u884c\u4e0a\u9762\u56fe\u4e2d\u7ea2\u8272\u7684\u64cd\u4f5c\u3002\u8fd9\u6837\u4f1a\u5bfc\u81f4\u4e22\u90e8\u5206\u5df2\u63d0\u4ea4\u4e8b\u52a1\u7684\u4fee\u6539\u4fe1\u606f\uff01<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u6240\u4ee5\u5f15\u5165\u4e86redo log\u6765\u8bb0\u5f55\u5df2\u6210\u529f\u63d0\u4ea4\u4e8b\u52a1\u7684\u4fee\u6539\u4fe1\u606f\uff0c\u5e76\u4e14\u4f1a\u628aredo log\u6301\u4e45\u5316\u5230\u78c1\u76d8\uff0c\u7cfb\u7edf\u91cd\u542f\u4e4b\u540e\u5728\u8bfb\u53d6redo log\u6062\u590d\u6700\u65b0\u6570\u636e\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><span style=\"letter-spacing: 0px;\">\u603b\u7ed3\uff1a<\/span><\/p>\n<blockquote style=\"font-size: 0.9em; overflow: auto; color: #6a737d; padding: 10px 10px 10px 20px; margin-bottom: 20px; margin-top: 20px; border-left-color: #ef7060; background: #fff9f9;\">\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; color: black; line-height: 26px;\">redo log\u662f\u7528\u6765\u6062\u590d\u6570\u636e\u7684 \u7528\u4e8e\u4fdd\u969c\uff0c\u5df2\u63d0\u4ea4\u4e8b\u52a1\u7684\u6301\u4e45\u5316\u7279\u6027<\/p>\n<\/blockquote>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 20px;\">2.undo log<\/h3>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u4ec0\u4e48\u662f undo log \uff1f<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">undo log \u53eb\u505a\u56de\u6eda\u65e5\u5fd7\uff0c\u7528\u4e8e\u8bb0\u5f55\u6570\u636e\u88ab\u4fee\u6539\u524d\u7684\u4fe1\u606f\u3002\u4ed6\u6b63\u597d\u8ddf\u524d\u9762\u6240\u8bf4\u7684\u91cd\u505a\u65e5\u5fd7\u6240\u8bb0\u5f55\u7684\u76f8\u53cd\uff0c\u91cd\u505a\u65e5\u5fd7\u8bb0\u5f55\u6570\u636e\u88ab\u4fee\u6539\u540e\u7684\u4fe1\u606f\u3002undo log\u4e3b\u8981\u8bb0\u5f55\u7684\u662f\u6570\u636e\u7684\u903b\u8f91\u53d8\u5316\uff0c\u4e3a\u4e86\u5728\u53d1\u751f\u9519\u8bef\u65f6\u56de\u6eda\u4e4b\u524d\u7684\u64cd\u4f5c\uff0c\u9700\u8981\u5c06\u4e4b\u524d\u7684\u64cd\u4f5c\u90fd\u8bb0\u5f55\u4e0b\u6765\uff0c\u7136\u540e\u5728\u53d1\u751f\u9519\u8bef\u65f6\u624d\u53ef\u4ee5\u56de\u6eda\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8fd8\u7528\u4e0a\u9762\u90a3\u4e24\u5f20\u8868<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><img decoding=\"async\" title=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/09\/1-1601048209-1.png\" alt=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" \/><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u6bcf\u6b21\u5199\u5165\u6570\u636e\u6216\u8005\u4fee\u6539\u6570\u636e\u4e4b\u524d\u90fd\u4f1a\u628a\u4fee\u6539\u524d\u7684\u4fe1\u606f\u8bb0\u5f55\u5230 undo log\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">undo log \u6709\u4ec0\u4e48\u4f5c\u7528\uff1f<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">undo log \u8bb0\u5f55\u4e8b\u52a1\u4fee\u6539\u4e4b\u524d\u7248\u672c\u7684\u6570\u636e\u4fe1\u606f\uff0c\u56e0\u6b64\u5047\u5982\u7531\u4e8e\u7cfb\u7edf\u9519\u8bef\u6216\u8005rollback\u64cd\u4f5c\u800c\u56de\u6eda\u7684\u8bdd\u53ef\u4ee5\u6839\u636eundo log\u7684\u4fe1\u606f\u6765\u8fdb\u884c\u56de\u6eda\u5230\u6ca1\u88ab\u4fee\u6539\u524d\u7684\u72b6\u6001\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u603b\u7ed3\uff1a<\/p>\n<blockquote style=\"font-size: 0.9em; overflow: auto; color: #6a737d; padding: 10px 10px 10px 20px; margin-bottom: 20px; margin-top: 20px; border-left-color: #ef7060; background: #fff9f9;\">\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; color: black; line-height: 26px;\">undo log\u662f\u7528\u6765\u56de\u6eda\u6570\u636e\u7684\u7528\u4e8e\u4fdd\u969c \u672a\u63d0\u4ea4\u4e8b\u52a1\u7684\u539f\u5b50\u6027<\/p>\n<\/blockquote>\n<h2 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; border-bottom: 2px solid #ef7060; font-size: 1.3em;\"><span style=\"display: inline-block; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e09\u3001mysql\u9501\u6280\u672f\u4ee5\u53caMVCC\u57fa\u7840<\/span><\/h2>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 20px;\">1. mysql\u9501\u6280\u672f<\/h3>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5f53\u6709\u591a\u4e2a\u8bf7\u6c42\u6765\u8bfb\u53d6\u8868\u4e2d\u7684\u6570\u636e\u65f6\u53ef\u4ee5\u4e0d\u91c7\u53d6\u4efb\u4f55\u64cd\u4f5c\uff0c\u4f46\u662f\u591a\u4e2a\u8bf7\u6c42\u91cc\u6709\u8bfb\u8bf7\u6c42\uff0c\u53c8\u6709\u4fee\u6539\u8bf7\u6c42\u65f6\u5fc5\u987b\u6709\u4e00\u79cd\u63aa\u65bd\u6765\u8fdb\u884c\u5e76\u53d1\u63a7\u5236\u3002\u4e0d\u7136\u5f88\u6709\u53ef\u80fd\u4f1a\u9020\u6210\u4e0d\u4e00\u81f4\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u8bfb\u5199\u9501<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u89e3\u51b3\u4e0a\u8ff0\u95ee\u9898\u5f88\u7b80\u5355\uff0c\u53ea\u9700\u7528\u4e24\u79cd\u9501\u7684\u7ec4\u5408\u6765\u5bf9\u8bfb\u5199\u8bf7\u6c42\u8fdb\u884c\u63a7\u5236\u5373\u53ef\uff0c\u8fd9\u4e24\u79cd\u9501\u88ab\u79f0\u4e3a\uff1a<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><strong>\u5171\u4eab\u9501(shared lock),\u53c8\u53eb\u505a&#8221;\u8bfb\u9501&#8221;<\/strong><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8bfb\u9501\u662f\u53ef\u4ee5\u5171\u4eab\u7684\uff0c\u6216\u8005\u8bf4\u591a\u4e2a\u8bfb\u8bf7\u6c42\u53ef\u4ee5\u5171\u4eab\u4e00\u628a\u9501\u8bfb\u6570\u636e\uff0c\u4e0d\u4f1a\u9020\u6210\u963b\u585e\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><strong>\u6392\u4ed6\u9501(exclusive lock),\u53c8\u53eb\u505a&#8221;\u5199\u9501&#8221;<\/strong><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5199\u9501\u4f1a\u6392\u65a5\u5176\u4ed6\u6240\u6709\u83b7\u53d6\u9501\u7684\u8bf7\u6c42\uff0c\u4e00\u76f4\u963b\u585e\uff0c\u76f4\u5230\u5199\u5165\u5b8c\u6210\u91ca\u653e\u9501\u3002<\/p>\n<p style=\"margin: 10px auto; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; text-align: left; white-space: normal; background-color: #ffffff;\"><img decoding=\"async\" style=\"max-width: 660px; border: 0px initial initial;\" title=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/09\/0-1601048209.png\" alt=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" \/><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u603b\u7ed3\uff1a\u901a\u8fc7\u8bfb\u5199\u9501\uff0c\u53ef\u4ee5\u505a\u5230\u8bfb\u8bfb\u53ef\u4ee5\u5e76\u884c\uff0c\u4f46\u662f\u4e0d\u80fd\u505a\u5230\u5199\u8bfb\uff0c\u5199\u5199\u5e76\u884c \u4e8b\u52a1\u7684\u9694\u79bb\u6027\u5c31\u662f\u6839\u636e\u8bfb\u5199\u9501\u6765\u5b9e\u73b0\u7684\uff01\uff01\uff01\u8fd9\u4e2a\u540e\u9762\u518d\u8bf4\u3002<\/p>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 20px;\">2. MVCC\u57fa\u7840<\/h3>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">MVCC (MultiVersion Concurrency Control) \u53eb\u505a\u591a\u7248\u672c\u5e76\u53d1\u63a7\u5236\u3002<\/p>\n<blockquote style=\"font-size: 0.9em; overflow: auto; color: #6a737d; padding: 10px 10px 10px 20px; margin-bottom: 20px; margin-top: 20px; border-left-color: #ef7060; background: #fff9f9;\">\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; color: black; line-height: 26px;\">InnoDB\u7684 MVCC \uff0c\u662f\u901a\u8fc7\u5728\u6bcf\u884c\u8bb0\u5f55\u7684\u540e\u9762\u4fdd\u5b58\u4e24\u4e2a\u9690\u85cf\u7684\u5217\u6765\u5b9e\u73b0\u7684\u3002\u8fd9\u4e24\u4e2a\u5217\uff0c \u4e00\u4e2a\u4fdd\u5b58\u4e86\u884c\u7684\u521b\u5efa\u65f6\u95f4\uff0c\u4e00\u4e2a\u4fdd\u5b58\u4e86\u884c\u7684\u8fc7\u671f\u65f6\u95f4\uff0c\u5f53\u7136\u5b58\u50a8\u7684\u5e76\u4e0d\u662f\u5b9e\u9645\u7684\u65f6\u95f4\u503c\uff0c\u800c\u662f\u7cfb\u7edf\u7248\u672c\u53f7\u3002<\/p>\n<\/blockquote>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4ee5\u4e0a\u7247\u6bb5\u6458\u81ea\u300a\u9ad8\u6027\u80fdMysql\u300b\u8fd9\u672c\u4e66\u5bf9MVCC\u7684\u5b9a\u4e49\u3002\u4ed6\u7684\u4e3b\u8981\u5b9e\u73b0\u601d\u60f3\u662f\u901a\u8fc7\u6570\u636e\u591a\u7248\u672c\u6765\u505a\u5230\u8bfb\u5199\u5206\u79bb\u3002\u4ece\u800c\u5b9e\u73b0\u4e0d\u52a0\u9501\u8bfb\u8fdb\u800c\u505a\u5230\u8bfb\u5199\u5e76\u884c\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">MVCC\u5728mysql\u4e2d\u7684\u5b9e\u73b0\u4f9d\u8d56\u7684\u662fundo log\u4e0eread view<\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">undo log :undo log \u4e2d\u8bb0\u5f55\u67d0\u884c\u6570\u636e\u7684\u591a\u4e2a\u7248\u672c\u7684\u6570\u636e\u3002<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">read view :\u7528\u6765\u5224\u65ad\u5f53\u524d\u7248\u672c\u6570\u636e\u7684\u53ef\u89c1\u6027<\/section>\n<\/li>\n<\/ul>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\"><img decoding=\"async\" title=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/09\/2-1601048209.png\" alt=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" \/><\/section>\n<h2 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; border-bottom: 2px solid #ef7060; font-size: 1.3em;\"><span style=\"display: inline-block; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u56db\u3001\u4e8b\u52a1\u7684\u5b9e\u73b0<\/span><\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u524d\u9762\u8bb2\u7684\u91cd\u505a\u65e5\u5fd7\uff0c\u56de\u6eda\u65e5\u5fd7\u4ee5\u53ca\u9501\u6280\u672f\u5c31\u662f\u5b9e\u73b0\u4e8b\u52a1\u7684\u57fa\u7840\u3002<\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u4e8b\u52a1\u7684\u539f\u5b50\u6027\u662f\u901a\u8fc7 undo log \u6765\u5b9e\u73b0\u7684<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u4e8b\u52a1\u7684\u6301\u4e45\u6027\u6027\u662f\u901a\u8fc7 redo log \u6765\u5b9e\u73b0\u7684<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u4e8b\u52a1\u7684\u9694\u79bb\u6027\u662f\u901a\u8fc7 (\u8bfb\u5199\u9501+MVCC)\u6765\u5b9e\u73b0\u7684<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u800c\u4e8b\u52a1\u7684\u7ec8\u6781\u5927 boss \u4e00\u81f4\u6027\u662f\u901a\u8fc7\u539f\u5b50\u6027\uff0c\u6301\u4e45\u6027\uff0c\u9694\u79bb\u6027\u6765\u5b9e\u73b0\u7684\uff01\uff01\uff01<\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u539f\u5b50\u6027\uff0c\u6301\u4e45\u6027\uff0c\u9694\u79bb\u6027\u6298\u817e\u534a\u5929\u7684\u76ee\u7684\u4e5f\u662f\u4e3a\u4e86\u4fdd\u969c\u6570\u636e\u7684\u4e00\u81f4\u6027\uff01<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u603b\u4e4b\uff0cACID\u53ea\u662f\u4e2a\u6982\u5ff5\uff0c\u4e8b\u52a1\u6700\u7ec8\u76ee\u7684\u662f\u8981\u4fdd\u969c\u6570\u636e\u7684\u53ef\u9760\u6027\uff0c\u4e00\u81f4\u6027\u3002<\/p>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 20px;\">1.\u539f\u5b50\u6027\u7684\u5b9e\u73b0<\/h3>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4ec0\u4e48\u662f\u539f\u5b50\u6027\uff1a<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e00\u4e2a\u4e8b\u52a1\u5fc5\u987b\u88ab\u89c6\u4e3a\u4e0d\u53ef\u5206\u5272\u7684\u6700\u5c0f\u5de5\u4f5c\u5355\u4f4d\uff0c\u4e00\u4e2a\u4e8b\u52a1\u4e2d\u7684\u6240\u6709\u64cd\u4f5c\u8981\u4e48\u5168\u90e8\u6210\u529f\u63d0\u4ea4\uff0c\u8981\u4e48\u5168\u90e8\u5931\u8d25\u56de\u6eda\uff0c\u5bf9\u4e8e\u4e00\u4e2a\u4e8b\u52a1\u6765\u8bf4\u4e0d\u53ef\u80fd\u53ea\u6267\u884c\u5176\u4e2d\u7684\u90e8\u5206\u64cd\u4f5c\uff0c\u8fd9\u5c31\u662f\u4e8b\u52a1\u7684\u539f\u5b50\u6027\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e0a\u9762\u8fd9\u6bb5\u8bdd\u53d6\u81ea\u300a\u9ad8\u6027\u80fdMySQL\u300b\u8fd9\u672c\u4e66\u5bf9\u539f\u5b50\u6027\u7684\u5b9a\u4e49\uff0c\u539f\u5b50\u6027\u53ef\u4ee5\u6982\u62ec\u4e3a\u5c31\u662f\u8981\u5b9e\u73b0\u8981\u4e48\u5168\u90e8\u5931\u8d25\uff0c\u8981\u4e48\u5168\u90e8\u6210\u529f\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4ee5\u4e0a\u6982\u5ff5\u76f8\u4fe1\u5927\u5bb6\u4f19\u513f\u90fd\u4e86\u89e3\uff0c\u90a3\u4e48\u6570\u636e\u5e93\u662f\u600e\u4e48\u5b9e\u73b0\u7684\u5462\uff1f\u5c31\u662f\u901a\u8fc7\u56de\u6eda\u64cd\u4f5c\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u6240\u8c13\u56de\u6eda\u64cd\u4f5c\u5c31\u662f\u5f53\u53d1\u751f\u9519\u8bef\u5f02\u5e38\u6216\u8005\u663e\u5f0f\u7684\u6267\u884crollback\u8bed\u53e5\u65f6\u9700\u8981\u628a\u6570\u636e\u8fd8\u539f\u5230\u539f\u5148\u7684\u6a21\u6837\uff0c\u6240\u4ee5\u8fd9\u65f6\u5019\u5c31\u9700\u8981\u7528\u5230undo log\u6765\u8fdb\u884c\u56de\u6eda\uff0c\u63a5\u4e0b\u6765\u770b\u4e00\u4e0bundo log\u5728\u5b9e\u73b0\u4e8b\u52a1\u539f\u5b50\u6027\u65f6\u600e\u4e48\u53d1\u6325\u4f5c\u7528\u7684<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">1.1 undo log \u7684\u751f\u6210<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5047\u8bbe\u6709\u4e24\u4e2a\u8868 bank\u548cfinance\uff0c\u8868\u4e2d\u539f\u59cb\u6570\u636e\u5982\u56fe\u6240\u793a\uff0c\u5f53\u8fdb\u884c\u63d2\u5165\uff0c\u5220\u9664\u4ee5\u53ca\u66f4\u65b0\u64cd\u4f5c\u65f6\u751f\u6210\u7684undo log\u5982\u4e0b\u9762\u56fe\u6240\u793a\uff1a<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u00a0<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><img decoding=\"async\" title=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/09\/8-1601048210.png\" alt=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" \/><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4ece\u4e0a\u56fe\u53ef\u4ee5\u4e86\u89e3\u5230\u6570\u636e\u7684\u53d8\u66f4\u90fd\u4f34\u968f\u7740\u56de\u6eda\u65e5\u5fd7\u7684\u4ea7\u751f\uff1a(1) \u4ea7\u751f\u4e86\u88ab\u4fee\u6539\u524d\u6570\u636e(zhangsan,1000) \u7684\u56de\u6eda\u65e5\u5fd7<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">(2) \u4ea7\u751f\u4e86\u88ab\u4fee\u6539\u524d\u6570\u636e(zhangsan,0) \u7684\u56de\u6eda\u65e5\u5fd7<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u6839\u636e\u4e0a\u9762\u6d41\u7a0b\u53ef\u4ee5\u5f97\u51fa\u5982\u4e0b\u7ed3\u8bba\uff1a<\/p>\n<ol class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u6bcf\u6761\u6570\u636e\u53d8\u66f4(insert\/update\/delete)\u64cd\u4f5c\u90fd\u4f34\u968f\u4e00\u6761undo log\u7684\u751f\u6210,\u5e76\u4e14\u56de\u6eda\u65e5\u5fd7\u5fc5\u987b\u5148\u4e8e\u6570\u636e\u6301\u4e45\u5316\u5230\u78c1\u76d8\u4e0a<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u6240\u8c13\u7684\u56de\u6eda\u5c31\u662f\u6839\u636e\u56de\u6eda\u65e5\u5fd7\u505a\u9006\u5411\u64cd\u4f5c\uff0c\u6bd4\u5982delete\u7684\u9006\u5411\u64cd\u4f5c\u4e3ainsert\uff0cinsert\u7684\u9006\u5411\u64cd\u4f5c\u4e3adelete\uff0cupdate\u7684\u9006\u5411\u4e3aupdate\u7b49\u3002<\/section>\n<\/li>\n<\/ol>\n<blockquote style=\"font-size: 0.9em; overflow: auto; color: #6a737d; padding: 10px 10px 10px 20px; margin-bottom: 20px; margin-top: 20px; border-left-color: #ef7060; background: #fff9f9;\">\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; color: black; line-height: 26px;\">\u601d\u8003\uff1a\u4e3a\u4ec0\u4e48\u5148\u5199\u65e5\u5fd7\u540e\u5199\u6570\u636e\u5e93\uff1f&#8212;\u7a0d\u540e\u505a\u89e3\u91ca<\/p>\n<\/blockquote>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">1.2 \u6839\u636eundo log \u8fdb\u884c\u56de\u6eda<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e3a\u4e86\u505a\u5230\u540c\u65f6\u6210\u529f\u6216\u8005\u5931\u8d25\uff0c\u5f53\u7cfb\u7edf\u53d1\u751f\u9519\u8bef\u6216\u8005\u6267\u884crollback\u64cd\u4f5c\u65f6\u9700\u8981\u6839\u636eundo log \u8fdb\u884c\u56de\u6eda<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><img decoding=\"async\" title=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/09\/4-1601048210.png\" alt=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" \/><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u56de\u6eda\u64cd\u4f5c\u5c31\u662f\u8981\u8fd8\u539f\u5230\u539f\u6765\u7684\u72b6\u6001\uff0cundo log\u8bb0\u5f55\u4e86\u6570\u636e\u88ab\u4fee\u6539\u524d\u7684\u4fe1\u606f\u4ee5\u53ca\u65b0\u589e\u548c\u88ab\u5220\u9664\u7684\u6570\u636e\u4fe1\u606f\uff0c\u6839\u636eundo log\u751f\u6210\u56de\u6eda\u8bed\u53e5\uff0c\u6bd4\u5982\uff1a<\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u5982\u679c\u5728\u56de\u6eda\u65e5\u5fd7\u91cc\u6709\u65b0\u589e\u6570\u636e\u8bb0\u5f55\uff0c\u5219\u751f\u6210\u5220\u9664\u8be5\u6761\u7684\u8bed\u53e5<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u5982\u679c\u5728\u56de\u6eda\u65e5\u5fd7\u91cc\u6709\u5220\u9664\u6570\u636e\u8bb0\u5f55\uff0c\u5219\u751f\u6210\u751f\u6210\u8be5\u6761\u7684\u8bed\u53e5<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u5982\u679c\u5728\u56de\u6eda\u65e5\u5fd7\u91cc\u6709\u4fee\u6539\u6570\u636e\u8bb0\u5f55\uff0c\u5219\u751f\u6210\u4fee\u6539\u5230\u539f\u5148\u6570\u636e\u7684\u8bed\u53e5<\/section>\n<\/li>\n<\/ul>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 20px;\">2.\u6301\u4e45\u6027\u7684\u5b9e\u73b0<\/h3>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e8b\u52a1\u4e00\u65e6\u63d0\u4ea4\uff0c\u5176\u6240\u4f5c\u505a\u7684\u4fee\u6539\u4f1a\u6c38\u4e45\u4fdd\u5b58\u5230\u6570\u636e\u5e93\u4e2d\uff0c\u6b64\u65f6\u5373\u4f7f\u7cfb\u7edf\u5d29\u6e83\u4fee\u6539\u7684\u6570\u636e\u4e5f\u4e0d\u4f1a\u4e22\u5931\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5148\u4e86\u89e3\u4e00\u4e0bMySQL\u7684\u6570\u636e\u5b58\u50a8\u673a\u5236\uff0cMySQL\u7684\u8868\u6570\u636e\u662f\u5b58\u653e\u5728\u78c1\u76d8\u4e0a\u7684\uff0c\u56e0\u6b64\u60f3\u8981\u5b58\u53d6\u7684\u65f6\u5019\u90fd\u8981\u7ecf\u5386\u78c1\u76d8IO,\u7136\u800c\u5373\u4f7f\u662f\u4f7f\u7528SSD\u78c1\u76d8IO\u4e5f\u662f\u975e\u5e38\u6d88\u8017\u6027\u80fd\u7684\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e3a\u6b64\uff0c\u4e3a\u4e86\u63d0\u5347\u6027\u80fdInnoDB\u63d0\u4f9b\u4e86\u7f13\u51b2\u6c60(Buffer Pool)\uff0cBuffer Pool\u4e2d\u5305\u542b\u4e86\u78c1\u76d8\u6570\u636e\u9875\u7684\u6620\u5c04\uff0c\u53ef\u4ee5\u5f53\u505a\u7f13\u5b58\u6765\u4f7f\u7528\uff1a<\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u8bfb\u6570\u636e\uff1a\u4f1a\u9996\u5148\u4ece\u7f13\u51b2\u6c60\u4e2d\u8bfb\u53d6\uff0c\u5982\u679c\u7f13\u51b2\u6c60\u4e2d\u6ca1\u6709\uff0c\u5219\u4ece\u78c1\u76d8\u8bfb\u53d6\u5728\u653e\u5165\u7f13\u51b2\u6c60\uff1b<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u5199\u6570\u636e\uff1a\u4f1a\u9996\u5148\u5199\u5165\u7f13\u51b2\u6c60\uff0c\u7f13\u51b2\u6c60\u4e2d\u7684\u6570\u636e\u4f1a\u5b9a\u671f\u540c\u6b65\u5230\u78c1\u76d8\u4e2d\uff1b<\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e0a\u9762\u8fd9\u79cd\u7f13\u51b2\u6c60\u7684\u63aa\u65bd\u867d\u7136\u5728\u6027\u80fd\u65b9\u9762\u5e26\u6765\u4e86\u8d28\u7684\u98de\u8dc3\uff0c\u4f46\u662f\u5b83\u4e5f\u5e26\u6765\u4e86\u65b0\u7684\u95ee\u9898\uff0c\u5f53MySQL\u7cfb\u7edf\u5b95\u673a\uff0c\u65ad\u7535\u7684\u65f6\u5019\u53ef\u80fd\u4f1a\u4e22\u6570\u636e\uff01\uff01\uff01<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u56e0\u4e3a\u6211\u4eec\u7684\u6570\u636e\u5df2\u7ecf\u63d0\u4ea4\u4e86\uff0c\u4f46\u6b64\u65f6\u662f\u5728\u7f13\u51b2\u6c60\u91cc\u5934\uff0c\u8fd8\u6ca1\u6765\u5f97\u53ca\u5728\u78c1\u76d8\u6301\u4e45\u5316\uff0c\u6240\u4ee5\u6211\u4eec\u6025\u9700\u4e00\u79cd\u673a\u5236\u9700\u8981\u5b58\u4e00\u4e0b\u5df2\u63d0\u4ea4\u4e8b\u52a1\u7684\u6570\u636e\uff0c\u4e3a\u6062\u590d\u6570\u636e\u4f7f\u7528\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e8e\u662f redo log\u5c31\u6d3e\u4e0a\u7528\u573a\u4e86\u3002\u4e0b\u9762\u770b\u4e0bredo log\u662f\u4ec0\u4e48\u65f6\u5019\u4ea7\u751f\u7684\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e8b\u52a1\u5f00\u59cb\u4e4b\u540e\u5c31\u4ea7\u751fredo log\uff0credo log\u7684\u843d\u76d8\u5e76\u4e0d\u662f\u968f\u7740\u4e8b\u52a1\u7684\u63d0\u4ea4\u624d\u5199\u5165\u7684\uff0c\u800c\u662f\u5728\u4e8b\u52a1\u7684\u6267\u884c\u8fc7\u7a0b\u4e2d\uff0c\u4fbf\u5f00\u59cb\u5199\u5165redo log\u6587\u4ef6\u4e2d\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u65e2\u7136redo log\u4e5f\u9700\u8981\u5b58\u50a8\uff0c\u4e5f\u6d89\u53ca\u78c1\u76d8IO\u4e3a\u5565\u8fd8\u7528\u5b83\uff1f<\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">redo log \u7684\u5b58\u50a8\u662f\u987a\u5e8f\u5b58\u50a8\uff0c\u800c\u7f13\u5b58\u540c\u6b65\u662f\u968f\u673a\u64cd\u4f5c\u3002<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u7f13\u5b58\u540c\u6b65\u662f\u4ee5\u6570\u636e\u9875\u4e3a\u5355\u4f4d\u7684\uff0c\u6bcf\u6b21\u4f20\u8f93\u7684\u6570\u636e\u5927\u5c0f\u5927\u4e8eredo log\u3002<\/section>\n<\/li>\n<\/ul>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 20px;\">3.\u9694\u79bb\u6027\u5b9e\u73b0<\/h3>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u9694\u79bb\u6027\u662f\u4e8b\u52a1ACID\u7279\u6027\u91cc\u6700\u590d\u6742\u7684\u4e00\u4e2a\u3002\u5728SQL\u6807\u51c6\u91cc\u5b9a\u4e49\u4e86\u56db\u79cd\u9694\u79bb\u7ea7\u522b\uff0c\u6bcf\u4e00\u79cd\u7ea7\u522b\u90fd\u89c4\u5b9a\u4e00\u4e2a\u4e8b\u52a1\u4e2d\u7684\u4fee\u6539\uff0c\u54ea\u4e9b\u662f\u4e8b\u52a1\u4e4b\u95f4\u53ef\u89c1\u7684\uff0c\u54ea\u4e9b\u662f\u4e0d\u53ef\u89c1\u7684\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u7ea7\u522b\u8d8a\u4f4e\u7684\u9694\u79bb\u7ea7\u522b\u53ef\u4ee5\u6267\u884c\u8d8a\u9ad8\u7684\u5e76\u53d1\uff0c\u4f46\u540c\u65f6\u5b9e\u73b0\u590d\u6742\u5ea6\u4ee5\u53ca\u5f00\u9500\u4e5f\u8d8a\u5927\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">Mysql \u9694\u79bb\u7ea7\u522b\u6709\u4ee5\u4e0b\u56db\u79cd\uff08\u7ea7\u522b\u7531\u4f4e\u5230\u9ad8\uff09\uff1a<\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">READ UNCOMMITED (\u672a\u63d0\u4ea4\u8bfb)<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">READ COMMITED (\u63d0\u4ea4\u8bfb)<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">REPEATABLE READ (\u53ef\u91cd\u590d\u8bfb)<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">SERIALIZABLE (\u53ef\u91cd\u590d\u8bfb)<\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u53ea\u8981\u5f7b\u5e95\u7406\u89e3\u4e86\u9694\u79bb\u7ea7\u522b\u4ee5\u53ca\u4ed6\u7684\u5b9e\u73b0\u539f\u7406\u5c31\u76f8\u5f53\u4e8e\u7406\u89e3\u4e86ACID\u91cc\u7684\u9694\u79bb\u578b\u3002\u524d\u9762\u8bf4\u8fc7\u539f\u5b50\u6027\uff0c\u9694\u79bb\u6027\uff0c\u6301\u4e45\u6027\u7684\u76ee\u7684\u90fd\u662f\u4e3a\u4e86\u8981\u505a\u5230\u4e00\u81f4\u6027\uff0c\u4f46\u9694\u79bb\u578b\u8ddf\u5176\u4ed6\u4e24\u4e2a\u6709\u6240\u533a\u522b\uff0c\u539f\u5b50\u6027\u548c\u6301\u4e45\u6027\u662f\u4e3a\u4e86\u8981\u5b9e\u73b0\u6570\u636e\u7684\u53ef\u6027\u4fdd\u969c\u9760\uff0c\u6bd4\u5982\u8981\u505a\u5230\u5b95\u673a\u540e\u7684\u6062\u590d\uff0c\u4ee5\u53ca\u9519\u8bef\u540e\u7684\u56de\u6eda\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u90a3\u4e48\u9694\u79bb\u6027\u662f\u8981\u505a\u5230\u4ec0\u4e48\u5462\uff1f\u9694\u79bb\u6027\u662f\u8981\u7ba1\u7406\u591a\u4e2a\u5e76\u53d1\u8bfb\u5199\u8bf7\u6c42\u7684\u8bbf\u95ee\u987a\u5e8f\u3002\u8fd9\u79cd\u987a\u5e8f\u5305\u62ec\u4e32\u884c\u6216\u8005\u662f\u5e76\u884c<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8bf4\u660e\u4e00\u70b9\uff0c\u5199\u8bf7\u6c42\u4e0d\u4ec5\u4ec5\u662f\u6307insert\u64cd\u4f5c\uff0c\u53c8\u5305\u62ecupdate\u64cd\u4f5c\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><img decoding=\"async\" title=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/09\/8-1601048210-1.png\" alt=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" \/><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u603b\u4e4b\uff0c\u4ece\u9694\u79bb\u6027\u7684\u5b9e\u73b0\u53ef\u4ee5\u770b\u51fa\u8fd9\u662f\u4e00\u573a\u6570\u636e\u7684\u53ef\u9760\u6027\u4e0e\u6027\u80fd\u4e4b\u95f4\u7684\u6743\u8861\u3002<\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u53ef\u9760\u6027\u6027\u9ad8\u7684\uff0c\u5e76\u53d1\u6027\u80fd\u4f4e(\u6bd4\u5982 Serializable)<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u53ef\u9760\u6027\u4f4e\u7684\uff0c\u5e76\u53d1\u6027\u80fd\u9ad8(\u6bd4\u5982 Read Uncommited)<\/section>\n<\/li>\n<\/ul>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">READ UNCOMMITTED<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5728READ UNCOMMITTED\u9694\u79bb\u7ea7\u522b\u4e0b\uff0c\u4e8b\u52a1\u4e2d\u7684\u4fee\u6539\u5373\u4f7f\u8fd8\u6ca1\u63d0\u4ea4\uff0c\u5bf9\u5176\u4ed6\u4e8b\u52a1\u662f\u53ef\u89c1\u7684\u3002\u4e8b\u52a1\u53ef\u4ee5\u8bfb\u53d6\u672a\u63d0\u4ea4\u7684\u6570\u636e\uff0c\u9020\u6210\u810f\u8bfb\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u56e0\u4e3a\u8bfb\u4e0d\u4f1a\u52a0\u4efb\u4f55\u9501\uff0c\u6240\u4ee5\u5199\u64cd\u4f5c\u5728\u8bfb\u7684\u8fc7\u7a0b\u4e2d\u4fee\u6539\u6570\u636e\uff0c\u6240\u4ee5\u4f1a\u9020\u6210\u810f\u8bfb\u3002\u597d\u5904\u662f\u53ef\u4ee5\u63d0\u5347\u5e76\u53d1\u5904\u7406\u6027\u80fd\uff0c\u80fd\u505a\u5230\u8bfb\u5199\u5e76\u884c\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u6362\u53e5\u8bdd\u8bf4\uff0c\u8bfb\u7684\u64cd\u4f5c\u4e0d\u80fd\u6392\u65a5\u5199\u8bf7\u6c42\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><img decoding=\"async\" title=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/09\/1-1601048210.png\" alt=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" \/><\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u4f18\u70b9\uff1a\u8bfb\u5199\u5e76\u884c\uff0c\u6027\u80fd\u9ad8<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u7f3a\u70b9\uff1a\u9020\u6210\u810f\u8bfb<\/section>\n<\/li>\n<\/ul>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">READ COMMITTED<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e00\u4e2a\u4e8b\u52a1\u7684\u4fee\u6539\u5728\u4ed6\u63d0\u4ea4\u4e4b\u524d\u7684\u6240\u6709\u4fee\u6539\uff0c\u5bf9\u5176\u4ed6\u4e8b\u52a1\u90fd\u662f\u4e0d\u53ef\u89c1\u7684\u3002\u5176\u4ed6\u4e8b\u52a1\u80fd\u8bfb\u5230\u5df2\u63d0\u4ea4\u7684\u4fee\u6539\u53d8\u5316\u3002\u5728\u5f88\u591a\u573a\u666f\u4e0b\u8fd9\u79cd\u903b\u8f91\u662f\u53ef\u4ee5\u63a5\u53d7\u7684\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">InnoDB\u5728 READ COMMITTED\uff0c\u4f7f\u7528\u6392\u5b83\u9501,\u8bfb\u53d6\u6570\u636e\u4e0d\u52a0\u9501\u800c\u662f\u4f7f\u7528\u4e86MVCC\u673a\u5236\u3002\u6216\u8005\u6362\u53e5\u8bdd\u8bf4\u4ed6\u91c7\u7528\u4e86\u8bfb\u5199\u5206\u79bb\u673a\u5236\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4f46\u662f\u8be5\u7ea7\u522b\u4f1a\u4ea7\u751f\u4e0d\u53ef\u91cd\u8bfb\u4ee5\u53ca\u5e7b\u8bfb\u95ee\u9898\u3002<span style=\"font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; text-align: left; color: #000000; background-color: #ffffff;\">\u5f80\u671f\uff1a<\/span>100\u671f\u9762\u8bd5\u9898\u6c47\u603b<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><strong>\u4ec0\u4e48\u662f\u4e0d\u53ef\u91cd\u8bfb\uff1f<\/strong><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5728\u4e00\u4e2a\u4e8b\u52a1\u5185\u591a\u6b21\u8bfb\u53d6\u7684\u7ed3\u679c\u4e0d\u4e00\u6837\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><strong>\u4e3a\u4ec0\u4e48\u4f1a\u4ea7\u751f\u4e0d\u53ef\u91cd\u590d\u8bfb\uff1f<\/strong><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8fd9\u8ddf READ COMMITTED \u7ea7\u522b\u4e0b\u7684MVCC\u673a\u5236\u6709\u5173\u7cfb\uff0c\u5728\u8be5\u9694\u79bb\u7ea7\u522b\u4e0b\u6bcf\u6b21 select\u7684\u65f6\u5019\u65b0\u751f\u6210\u4e00\u4e2a\u7248\u672c\u53f7\uff0c\u6240\u4ee5\u6bcf\u6b21select\u7684\u65f6\u5019\u8bfb\u7684\u4e0d\u662f\u4e00\u4e2a\u526f\u672c\u800c\u662f\u4e0d\u540c\u7684\u526f\u672c\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5728\u6bcf\u6b21select\u4e4b\u95f4\u6709\u5176\u4ed6\u4e8b\u52a1\u66f4\u65b0\u4e86\u6211\u4eec\u8bfb\u53d6\u7684\u6570\u636e\u5e76\u63d0\u4ea4\u4e86\uff0c\u90a3\u5c31\u51fa\u73b0\u4e86\u4e0d\u53ef\u91cd\u590d\u8bfb<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><img decoding=\"async\" title=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/09\/8-1601048210-2.png\" alt=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" \/><\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">REPEATABLE READ(Mysql\u9ed8\u8ba4\u9694\u79bb\u7ea7\u522b)<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5728\u4e00\u4e2a\u4e8b\u52a1\u5185\u7684\u591a\u6b21\u8bfb\u53d6\u7684\u7ed3\u679c\u662f\u4e00\u6837\u7684\u3002\u8fd9\u79cd\u7ea7\u522b\u4e0b\u53ef\u4ee5\u907f\u514d\uff0c\u810f\u8bfb\uff0c\u4e0d\u53ef\u91cd\u590d\u8bfb\u7b49\u67e5\u8be2\u95ee\u9898\u3002mysql \u6709\u4e24\u79cd\u673a\u5236\u53ef\u4ee5\u8fbe\u5230\u8fd9\u79cd\u9694\u79bb\u7ea7\u522b\u7684\u6548\u679c\uff0c\u5206\u522b\u662f\u91c7\u7528\u8bfb\u5199\u9501\u4ee5\u53caMVCC\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><strong>\u91c7\u7528\u8bfb\u5199\u9501\u5b9e\u73b0\uff1a<\/strong><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><strong><img decoding=\"async\" title=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/09\/4-1601048210-1.png\" alt=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" \/><\/strong><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e3a\u4ec0\u4e48\u80fd\u53ef\u91cd\u590d\u5ea6\uff1f\u53ea\u8981\u6ca1\u91ca\u653e\u8bfb\u9501\uff0c\u5728\u6b21\u8bfb\u7684\u65f6\u5019\u8fd8\u662f\u53ef\u4ee5\u8bfb\u5230\u7b2c\u4e00\u6b21\u8bfb\u7684\u6570\u636e\u3002<\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u4f18\u70b9\uff1a\u5b9e\u73b0\u8d77\u6765\u7b80\u5355<\/p>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u7f3a\u70b9\uff1a\u65e0\u6cd5\u505a\u5230\u8bfb\u5199\u5e76\u884c<\/p>\n<\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><strong>\u91c7\u7528MVCC\u5b9e\u73b0\uff1a<\/strong><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><strong><img decoding=\"async\" title=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/09\/6-1601048210.png\" alt=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" \/><\/strong><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e3a\u4ec0\u4e48\u80fd\u53ef\u91cd\u590d\u5ea6\uff1f\u56e0\u4e3a\u591a\u6b21\u8bfb\u53d6\u53ea\u751f\u6210\u4e00\u4e2a\u7248\u672c\uff0c\u8bfb\u5230\u7684\u81ea\u7136\u662f\u76f8\u540c\u6570\u636e\u3002<\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u4f18\u70b9\uff1a\u8bfb\u5199\u5e76\u884c<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u7f3a\u70b9\uff1a\u5b9e\u73b0\u7684\u590d\u6742\u5ea6\u9ad8<\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4f46\u662f\u5728\u8be5\u9694\u79bb\u7ea7\u522b\u4e0b\u4ecd\u4f1a\u5b58\u5728\u5e7b\u8bfb\u7684\u95ee\u9898\uff0c\u5173\u4e8e\u5e7b\u8bfb\u7684\u89e3\u51b3\u6211\u6253\u7b97\u53e6\u5f00\u4e00\u7bc7\u6765\u4ecb\u7ecd\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">SERIALIZABLE<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8be5\u9694\u79bb\u7ea7\u522b\u7406\u89e3\u8d77\u6765\u6700\u7b80\u5355\uff0c\u5b9e\u73b0\u4e5f\u6700\u5355\u3002\u5728\u9694\u79bb\u7ea7\u522b\u4e0b\u9664\u4e86\u4e0d\u4f1a\u9020\u6210\u6570\u636e\u4e0d\u4e00\u81f4\u95ee\u9898\uff0c\u6ca1\u5176\u4ed6\u4f18\u70b9\u3002<\/p>\n<p style=\"margin: 10px auto;\"><img decoding=\"async\" style=\"max-width: 660px; border: 0px initial initial;\" title=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/09\/5-1601048210.png\" alt=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" \/><\/p>\n<p style=\"margin: 10px auto;\"><img decoding=\"async\" style=\"max-width: 660px; border: 0px initial initial;\" title=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/09\/3-1601048210.png\" alt=\"MySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\" \/><\/p>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 20px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; text-align: left; white-space: normal; background-color: #ffffff;\">4.\u4e00\u81f4\u6027\u7684\u5b9e\u73b0<\/h3>\n<p style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 26px;\">\u6570\u636e\u5e93\u603b\u662f\u4ece\u4e00\u4e2a\u4e00\u81f4\u6027\u7684\u72b6\u6001\u8f6c\u79fb\u5230\u53e6\u4e00\u4e2a\u4e00\u81f4\u6027\u7684\u72b6\u6001.<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 26px;\">\u4e0b\u9762\u4e3e\u4e2a\u4f8b\u5b50:zhangsan \u4ece\u94f6\u884c\u5361\u8f6c400\u5230\u7406\u8d22\u8d26\u6237<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; color: #000000; font-size: 16px; text-align: left; background-color: #ffffff; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\"><code style=\"padding: 15px 16px 16px; overflow-x: auto; color: #abb2bf; display: -webkit-box; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; font-size: 12px; background: #282c34; border-radius: 5px;\">start\u00a0transaction;<br \/>select\u00a0balance\u00a0from\u00a0bank\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">where<\/span>\u00a0name=<span style=\"color: #98c379; line-height: 26px;\">\"zhangsan\"<\/span>;<br \/>\/\/\u00a0\u751f\u6210\u00a0\u91cd\u505a\u65e5\u5fd7\u00a0balance=600<br \/>update\u00a0bank\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">set<\/span>\u00a0balance\u00a0=\u00a0balance\u00a0-\u00a0400;\u00a0<br \/>\/\/\u00a0\u751f\u6210\u00a0\u91cd\u505a\u65e5\u5fd7\u00a0amount=400<br \/>update\u00a0finance\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">set<\/span>\u00a0amount\u00a0=\u00a0amount\u00a0+\u00a0400;<br \/>commit;<br \/><\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 26px;\">1.\u5047\u5982\u6267\u884c\u5b8c update bank set balance = balance &#8211; 400;\u4e4b\u53d1\u751f\u5f02\u5e38\u4e86\uff0c\u94f6\u884c\u5361\u7684\u94b1\u4e5f\u4e0d\u80fd\u5e73\u767d\u65e0\u8f9c\u7684\u51cf\u5c11\uff0c\u800c\u662f\u56de\u6eda\u5230\u6700\u521d\u72b6\u6001\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 26px;\">2.\u53c8\u6216\u8005\u4e8b\u52a1\u63d0\u4ea4\u4e4b\u540e\uff0c\u7f13\u51b2\u6c60\u8fd8\u6ca1\u540c\u6b65\u5230\u78c1\u76d8\u7684\u65f6\u5019\u5b95\u673a\u4e86\uff0c\u8fd9\u4e5f\u662f\u4e0d\u80fd\u63a5\u53d7\u7684\uff0c\u5e94\u8be5\u5728\u91cd\u542f\u7684\u65f6\u5019\u6062\u590d\u5e76\u6301\u4e45\u5316\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 26px;\">3.\u5047\u5982\u6709\u5e76\u53d1\u4e8b\u52a1\u8bf7\u6c42\u7684\u65f6\u5019\u4e5f\u5e94\u8be5\u505a\u597d\u4e8b\u52a1\u4e4b\u95f4\u7684\u53ef\u89c1\u6027\u95ee\u9898\uff0c\u907f\u514d\u9020\u6210\u810f\u8bfb\uff0c\u4e0d\u53ef\u91cd\u590d\u8bfb\uff0c\u5e7b\u8bfb\u7b49\u3002\u5728\u6d89\u53ca\u5e76\u53d1\u7684\u60c5\u51b5\u4e0b\u5f80\u5f80\u5728\u6027\u80fd\u548c\u4e00\u81f4\u6027\u4e4b\u95f4\u505a\u5e73\u8861\uff0c\u505a\u4e00\u5b9a\u7684\u53d6\u820d\uff0c\u6240\u4ee5\u9694\u79bb\u6027\u4e5f\u662f\u5bf9\u4e00\u81f4\u6027\u7684\u4e00\u79cd\u7834\u574f\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 26px;\">\u00a0<\/p>\n<h2 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 1.3em; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; text-align: left; white-space: normal; background-color: #ffffff; border-bottom: 2px solid #ef7060;\"><span style=\"margin-right: 3px; padding: 3px 10px 1px; display: inline-block; background: #ef7060; color: #ffffff; border-top-right-radius: 3px; border-top-left-radius: 3px;\">\u603b\u7ed3<\/span><\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 26px;\">\u672c\u6587\u51fa\u53d1\u70b9\u662f\u60f3\u8bb2\u4e00\u4e0bMysql\u7684\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff; line-height: 26px;\">\u5b9e\u73b0\u4e8b\u52a1\u91c7\u53d6\u4e86\u54ea\u4e9b\u6280\u672f\u4ee5\u53ca\u601d\u60f3\uff1f<\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px; color: #000000; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 16px; text-align: left; white-space: normal; background-color: #ffffff;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u539f\u5b50\u6027\uff1a\u4f7f\u7528 undo log \uff0c\u4ece\u800c\u8fbe\u5230\u56de\u6eda<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u6301\u4e45\u6027\uff1a\u4f7f\u7528 redo log\uff0c\u4ece\u800c\u8fbe\u5230\u6545\u969c\u540e\u6062\u590d<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u9694\u79bb\u6027\uff1a\u4f7f\u7528\u9501\u4ee5\u53caMVCC,\u8fd0\u7528\u7684\u4f18\u5316\u601d\u60f3\u6709\u8bfb\u5199\u5206\u79bb\uff0c\u8bfb\u8bfb\u5e76\u884c\uff0c\u8bfb\u5199\u5e76\u884c<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u4e00\u81f4\u6027\uff1a\u901a\u8fc7\u56de\u6eda\uff0c\u4ee5\u53ca\u6062\u590d\uff0c\u548c\u5728\u5e76\u53d1\u73af\u5883\u4e0b\u7684\u9694\u79bb\u505a\u5230\u4e00\u81f4\u6027\u3002<\/section>\n<\/li>\n<\/ul>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p style=\"margin-top: 25px; margin-right: 14px; margin-bottom: 25px; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background: #ffffff; line-height: 2em; text-align: center; box-sizing: border-box !important; overflow-wrap: break-word !important;\"><strong style=\"letter-spacing: 0.544px; color: #3e3e3e; max-width: 100%; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 16.3636px; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\u00b7END\u00b7<\/strong><\/p>\n<section style=\"white-space: normal; max-width: 100%; color: #3e3e3e; font-size: 16px; line-height: 25.6px; background-color: #ffffff; font-family: \u5fae\u8f6f\u96c5\u9ed1; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; line-height: 25.6px; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; line-height: 25.6px; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; line-height: 25.6px; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; line-height: 25.6px; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; line-height: 25.6px; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section style=\"max-width: 100%; white-space: normal; color: #3e3e3e; font-size: 16px; line-height: 25.6px; background-color: #ffffff; font-family: \u5fae\u8f6f\u96c5\u9ed1; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; line-height: 25.6px; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; line-height: 25.6px; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;\"><hr style=\"max-width: 100%; font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; border-style: solid; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-color: rgba(0, 0, 0, 0.1); transform-origin: 0px 0px; transform: scale(1, 0.5); overflow-wrap: break-word !important; box-sizing: border-box !important;\" \/>\n<section style=\"max-width: 100%; color: #3f3f3f; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; letter-spacing: 0.544px; text-align: left; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; color: #a0a0a0; font-family: \u5fae\u8f6f\u96c5\u9ed1; letter-spacing: 0.544px; text-align: center; widows: 1; word-spacing: 2px; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; line-height: 25.6px; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<blockquote>\n<p style=\"max-width: 100%; min-height: 1em; text-align: left; overflow-wrap: break-word !important; box-sizing: border-box !important;\"><span style=\"max-width: 100%; font-size: 13px; letter-spacing: 0.544px; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\u4f5c\u8005<\/span><span style=\"max-width: 100%; font-size: 13px; letter-spacing: 0.544px; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\uff1a\u5c0f\u5c0f\u6728<\/span><\/p>\n<p style=\"max-width: 100%; min-height: 1em; text-align: left; overflow-wrap: break-word !important; box-sizing: border-box !important;\"><span style=\"font-size: 13px; letter-spacing: 0.544px; color: #a0a0a0;\">\u6765\u6e90\uff1a<\/span><span style=\"font-size: 13px; letter-spacing: 0.544px; color: #a0a0a0;\">cnb<\/span><span style=\"font-size: 13px; letter-spacing: 0.544px; color: #a0a0a0;\">log<\/span><span style=\"font-size: 13px; letter-spacing: 0.544px; color: #a0a0a0;\">s.com\/wyc1994666\/p\/11367051.html<\/span><\/p>\n<p style=\"text-align: left;\"><span style=\"text-align: left; letter-spacing: 0.544px; color: #888888; font-size: 11px;\">\u7248\u6743\u7533\u660e\uff1a<\/span><span style=\"text-align: left; letter-spacing: 0.544px; color: #888888; font-size: 11px;\">\u5185\u5bb9\u6765\u6e90\u7f51\u7edc\uff0c\u7248\u6743\u5f52\u539f\u521b\u8005\u6240\u6709<\/span><\/p>\n<\/blockquote>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<section style=\"padding-right: 10px; padding-left: 10px; max-width: 100%; text-align: center; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.5px; widows: 1; word-spacing: 2px; overflow-wrap: break-word !important; box-sizing: border-box !important;\">\n<section style=\"max-width: 100%; letter-spacing: 0.544px; color: #a0a0a0; font-family: \u5fae\u8f6f\u96c5\u9ed1; overflow-wrap: break-word !important; box-sizing: border-box !important;\"><\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/div>\n\n\n<p>\u8f6c\u81ea\uff1ahttps:\/\/mp.weixin.qq.com\/s\/79HhQsZRzzuskP5p5LNONA<\/p>\n\n\n\n<p> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u5f00\u7bc7 \u76f8\u4fe1\u5927\u5bb6\u90fd\u7528\u8fc7\u4e8b\u52a1\u4ee5\u53ca\u4e86\u89e3\u4ed6\u7684\u7279\u70b9\uff0c\u5982\u539f\u5b50\u6027(Atomicity),\u4e00\u81f4\u6027(Consistency) &hellip; <a href=\"http:\/\/www.zhushiyao.com\/?p=41003\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cMySQL\u4e8b\u52a1\u7684\u5b9e\u73b0\u539f\u7406\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[194],"_links":{"self":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/41003"}],"collection":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=41003"}],"version-history":[{"count":2,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/41003\/revisions"}],"predecessor-version":[{"id":41021,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/41003\/revisions\/41021"}],"wp:attachment":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=41003"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=41003"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=41003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}