{"id":197398,"date":"2020-09-07T10:10:29","date_gmt":"2020-09-07T02:10:29","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=197398"},"modified":"2020-08-28T10:11:06","modified_gmt":"2020-08-28T02:11:06","slug":"underlying-principles-innodb","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/underlying-principles-innodb.html","title":{"rendered":"\u65e0\u6c34\u5e72\u8d27\uff1aInnoDB\u5e95\u5c42\u539f\u7406"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5f88\u591a\u6587\u7ae0\u90fd\u662f\u76f4\u63a5\u5f00\u59cb\u4ecb\u7ecd\u6709\u54ea\u4e9b\u5b58\u50a8\u5f15\u64ce\uff0c\u5e76\u6ca1\u6709\u53bb\u4ecb\u7ecd\u5b58\u50a8\u5f15\u64ce\u672c\u8eab\u3002\u90a3\u4e48\u7a76\u7adf\u4ec0\u4e48\u662f\u5b58\u50a8\u5f15\u64ce?\u4e0d\u77e5\u9053\u5927\u5bb6\u6709\u6ca1\u6709\u60f3\u8fc7\uff0cMySQL\u662f\u5982\u4f55\u5b58\u50a8\u6211\u4eec\u4e22\u8fdb\u53bb\u7684\u6570\u636e\u7684?<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u5b58\u50a8\u5f15\u64ce<\/strong><\/div>\n

\u5f88\u591a\u6587\u7ae0\u90fd\u662f\u76f4\u63a5\u5f00\u59cb\u4ecb\u7ecd\u6709\u54ea\u4e9b\u5b58\u50a8\u5f15\u64ce\uff0c\u5e76\u6ca1\u6709\u53bb\u4ecb\u7ecd\u5b58\u50a8\u5f15\u64ce\u672c\u8eab\u3002\u90a3\u4e48\u7a76\u7adf\u4ec0\u4e48\u662f\u5b58\u50a8\u5f15\u64ce?\u4e0d\u77e5\u9053\u5927\u5bb6\u6709\u6ca1\u6709\u60f3\u8fc7\uff0cMySQL\u662f\u5982\u4f55\u5b58\u50a8\u6211\u4eec\u4e22\u8fdb\u53bb\u7684\u6570\u636e\u7684?<\/p>\n

\u5176\u5b9e\u5b58\u50a8\u5f15\u64ce\u4e5f\u5f88\u7b80\u5355\uff0c\u6211\u8ba4\u4e3a\u5c31\u662f\u4e00\u79cd\u5b58\u50a8\u89e3\u51b3\u65b9\u6848\uff0c\u5b9e\u73b0\u4e86\u65b0\u589e\u6570\u636e\u3001\u66f4\u65b0\u6570\u636e\u548c\u5efa\u7acb\u7d22\u5f15\u7b49\u7b49\u529f\u80fd\u3002<\/p>\n

\u6709\u54ea\u4e9b\u5df2\u6709\u7684\u5b58\u50a8\u5f15\u64ce\u53ef\u4ee5\u8ba9\u6211\u4eec\u9009\u62e9\u5462?<\/p>\n

InnoDB\u3001MyISAM\u3001Memory\u3001CSV\u3001Archive\u3001Blackhole\u3001Merge\u3001Federated\u3001Example<\/p>\n

\u79cd\u7c7b\u5f88\u591a\uff0c\u4f46\u662f\u5e38\u7528\u7684\u5b58\u50a8\u5f15\u64ce\u76ee\u524d\u5c31\u53ea\u6709InnoDB\u548cMyISAM\uff0c\u6211\u4e5f\u4f1a\u7740\u91cd\u6765\u4ecb\u7ecd\u8fd9\u4e24\u79cd\u5b58\u50a8\u5f15\u64ce\u3002<\/p>\n

InnoDB\u662f\u76ee\u524d\u4f7f\u7528\u6700\u5e7f\u7684MySQL\u5b58\u50a8\u5f15\u64ce\uff0cMySQL\u4ece5.5\u7248\u672c\u5f00\u59cbInnoDB\u5c31\u5df2\u7ecf\u662f\u9ed8\u8ba4\u7684\u5b58\u50a8\u5f15\u64ce\u4e86\u3002\u90a3\u4f60\u77e5\u9053\u4e3a\u4ec0\u4e48InnoDB\u88ab\u5e7f\u6cdb\u7684\u4f7f\u7528\u5462?\u5148\u628a\u8fd9\u4e2a\u95ee\u9898\u653e\u4e00\u653e\uff0c\u6211\u4eec\u5148\u6765\u4e86\u89e3\u4e00\u4e0bInnoDB\u5b58\u50a8\u5f15\u64ce\u7684\u5e95\u5c42\u539f\u7406\u3002<\/p>\n

InnoDB\u7684\u5185\u5b58\u67b6\u6784\u4e3b\u8981\u5206\u4e3a\u4e09\u5927\u5757\uff0c\u7f13\u51b2\u6c60(Buffer Pool)\u3001\u91cd\u505a\u7f13\u51b2\u6c60(Redo Log Buffer)\u548c\u989d\u5916\u5185\u5b58\u6c60<\/p>\n

\u7f13\u51b2\u6c60<\/strong><\/div>\n

InnoDB\u4e3a\u4e86\u505a\u6570\u636e\u7684\u6301\u4e45\u5316\uff0c\u4f1a\u5c06\u6570\u636e\u5b58\u50a8\u5230\u78c1\u76d8\u4e0a\u3002\u4f46\u662f\u9762\u5bf9\u5927\u91cf\u7684\u8bf7\u6c42\u65f6\uff0cCPU\u7684\u5904\u7406\u901f\u5ea6\u548c\u78c1\u76d8\u7684IO\u901f\u5ea6\u4e4b\u95f4\u5dee\u8ddd\u592a\u5927\uff0c\u4e3a\u4e86\u63d0\u9ad8\u6574\u4f53\u7684\u6548\u7387\uff0c InnoDB\u5f15\u5165\u4e86\u7f13\u51b2\u6c60\u3002<\/p>\n

\u5f53\u6709\u8bf7\u6c42\u6765\u67e5\u8be2\u6570\u636e\u65f6\uff0c\u5982\u679c\u7f13\u5b58\u6c60\u4e2d\u6ca1\u6709\uff0c\u5c31\u4f1a\u53bb\u78c1\u76d8\u4e2d\u67e5\u627e\uff0c\u5c06\u5339\u914d\u5230\u7684\u6570\u636e\u653e\u5165\u7f13\u5b58\u6c60\u4e2d\u3002\u540c\u6837\u7684\uff0c\u5982\u679c\u6709\u8bf7\u6c42\u6765\u4fee\u6539\u6570\u636e\uff0cMySQL\u5e76\u4e0d\u4f1a\u76f4\u63a5\u53bb\u4fee\u6539\u78c1\u76d8\uff0c\u800c\u662f\u4f1a\u4fee\u6539\u5df2\u7ecf\u5728\u7f13\u51b2\u6c60\u7684\u9875\u4e2d\u7684\u6570\u636e\uff0c\u7136\u540e\u518d\u5c06\u6570\u636e\u5237\u56de\u78c1\u76d8\uff0c\u8fd9\u5c31\u662f\u7f13\u51b2\u6c60\u7684\u4f5c\u7528\uff0c\u52a0\u901f\u8bfb\uff0c\u52a0\u901f\u5199\uff0c\u51cf\u5c11\u4e0e\u78c1\u76d8\u7684IO\u4ea4\u4e92\u3002<\/p>\n

\u7f13\u51b2\u6c60\u8bf4\u767d\u4e86\u5c31\u662f\u628a\u78c1\u76d8\u4e2d\u7684\u6570\u636e\u4e22\u5230\u5185\u5b58\uff0c\u90a3\u65e2\u7136\u662f\u5185\u5b58\u5c31\u4f1a\u5b58\u5728\u6ca1\u6709\u5185\u5b58\u7a7a\u95f4\u53ef\u4ee5\u5206\u914d\u7684\u60c5\u51b5\u3002\u6240\u4ee5\u7f13\u51b2\u6c60\u91c7\u7528\u4e86LRU\u7b97\u6cd5\uff0c\u5728\u7f13\u51b2\u6c60\u4e2d\u6ca1\u6709\u7a7a\u95f2\u7684\u9875\u65f6\uff0c\u6765\u8fdb\u884c\u9875\u7684\u6dd8\u6c70\u3002\u4f46\u662f\u91c7\u7528\u8fd9\u79cd\u7b97\u6cd5\u4f1a\u5e26\u6765\u4e00\u4e2a\u95ee\u9898\u53eb\u505a\u7f13\u51b2\u6c60\u6c61\u67d3\u3002<\/p>\n

\u5f53\u4f60\u5728\u8fdb\u884c\u6279\u91cf\u626b\u63cf\u751a\u81f3\u5168\u8868\u626b\u63cf\u65f6\uff0c\u53ef\u80fd\u4f1a\u5c06\u7f13\u51b2\u6c60\u4e2d\u7684\u70ed\u70b9\u9875\u5168\u90e8\u66ff\u6362\u51fa\u53bb\u3002\u8fd9\u6837\u4ee5\u6765\u53ef\u80fd\u4f1a\u5bfc\u81f4MySQL\u7684\u6027\u80fd\u65ad\u5d16\u5f0f\u4e0b\u964d\u3002\u6240\u4ee5InnoDB\u5bf9LRU\u505a\u4e86\u4e00\u4e9b\u4f18\u5316\uff0c\u89c4\u907f\u4e86\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n

MySQL\u91c7\u7528\u65e5\u5fd7\u5148\u884c\uff0c\u5728\u771f\u6b63\u5199\u6570\u636e\u4e4b\u524d\uff0c\u4f1a\u9996\u5148\u8bb0\u5f55\u4e00\u4e2a\u65e5\u5fd7\uff0c\u53ebRedo Log\uff0c\u4f1a\u5b9a\u671f\u7684\u4f7f\u7528CheckPoint\u6280\u672f\u5c06\u65b0\u7684Redo Log\u5237\u5165\u78c1\u76d8\uff0c\u8fd9\u4e2a\u540e\u9762\u4f1a\u8bb2\u3002<\/p>\n

\u9664\u4e86\u6570\u636e\u4e4b\u5916\uff0c\u91cc\u9762\u8fd8\u5b58\u50a8\u4e86\u7d22\u5f15\u9875\u3001Undo\u9875\u3001\u63d2\u5165\u7f13\u51b2\u3001\u81ea\u9002\u5e94\u54c8\u5e0c\u7d22\u5f15\u3001InnoDB\u9501\u4fe1\u606f\u548c\u6570\u636e\u5b57\u5178\u3002\u4e0b\u9762\u9009\u51e0\u4e2a\u6bd4\u8f83\u91cd\u8981\u7684\u6765\u7b80\u5355\u804a\u4e00\u804a\u3002<\/p>\n

\u63d2\u5165\u7f13\u51b2<\/strong><\/div>\n

\u63d2\u5165\u7f13\u51b2\u9488\u5bf9\u7684\u64cd\u4f5c\u662f\u66f4\u65b0\u6216\u8005\u63d2\u5165\uff0c\u6211\u4eec\u8003\u8651\u6700\u574f\u7684\u60c5\u51b5\uff0c\u90a3\u5c31\u662f\u9700\u8981\u66f4\u65b0\u7684\u6570\u636e\u90fd\u4e0d\u5728\u7f13\u51b2\u6c60\u4e2d\u3002\u90a3\u4e48\u6b64\u65f6\u4f1a\u6709\u4e0b\u9762\u4e24\u79cd\u65b9\u6848\u3002<\/p>\n

\u6765\u4e00\u6761\u6570\u636e\u5c31\u76f4\u63a5\u5199\u5165\u78c1\u76d8
\n\u7b49\u6570\u636e\u8fbe\u5230\u67d0\u4e2a\u9608\u503c(\u4f8b\u598250\u6761)\u624d\u6279\u91cf\u7684\u5199\u5165\u78c1\u76d8
\n\u5f88\u660e\u663e\uff0c\u7b2c\u4e8c\u79cd\u65b9\u6848\u8981\u597d\u4e00\u70b9\uff0c\u51cf\u5c11\u4e86\u4e0e\u78c1\u76d8IO\u7684\u4ea4\u4e92\u3002<\/p>\n

\u4e24\u6b21\u5199<\/strong><\/div>\n

\u9274\u4e8e\u90fd\u804a\u5230\u4e86\u63d2\u5165\u7f13\u51b2\uff0c\u6211\u5c31\u4e0d\u5f97\u4e0d\u9700\u8981\u63d0\u4e00\u5634\u4e24\u6b21\u5199\uff0c\u56e0\u4e3a\u6211\u8ba4\u4e3a\u8fd9\u4e24\u4e2aInnoDB\u7684\u7279\u6027\u662f\u76f8\u8f85\u76f8\u6210\u7684\u3002<\/p>\n

\u63d2\u5165\u7f13\u51b2\u63d0\u9ad8\u4e86MySQL\u7684\u6027\u80fd\uff0c\u800c\u4e24\u6b21\u5199\u5219\u5728\u6b64\u57fa\u7840\u4e0a\u63d0\u9ad8\u4e86\u6570\u636e\u7684\u53ef\u9760\u6027\u3002\u6211\u4eec\u77e5\u9053\uff0c\u5f53\u6570\u636e\u8fd8\u5728\u7f13\u51b2\u6c60\u4e2d\u7684\u65f6\u5019\uff0c\u5f53\u673a\u5668\u5b95\u673a\u4e86\uff0c\u53d1\u751f\u4e86\u5199\u5931\u6548\uff0c\u6709Redo Log\u6765\u8fdb\u884c\u6062\u590d\u3002\u4f46\u662f\u5982\u679c\u662f\u5728\u4ece\u7f13\u51b2\u6c60\u4e2d\u5c06\u6570\u636e\u5237\u56de\u78c1\u76d8\u7684\u65f6\u5019\u5b95\u673a\u4e86\u5462?<\/p>\n

\u8fd9\u79cd\u60c5\u51b5\u53eb\u505a\u90e8\u5206\u5199\u5931\u6548\uff0c\u6b64\u65f6\u91cd\u505a\u65e5\u5fd7\u5c31\u65e0\u6cd5\u89e3\u51b3\u95ee\u9898\u3002<\/p>\n

\"\"<\/p>\n

\u5728\u5237\u810f\u9875\u65f6\uff0c\u5e76\u4e0d\u662f\u76f4\u63a5\u5237\u5165\u78c1\u76d8\uff0c\u800c\u662fcopy\u5230\u5185\u5b58\u4e2d\u7684Doublewrite Buffer\u4e2d\uff0c\u7136\u540e\u518d\u62f7\u8d1d\u81f3\u78c1\u76d8\u5171\u4eab\u8868\u7a7a\u95f4(\u4f60\u53ef\u4ee5\u5c31\u7406\u89e3\u4e3a\u78c1\u76d8)\u4e2d\uff0c\u6bcf\u6b21\u5199\u51651M\uff0c\u7b49copy\u5b8c\u6210\u540e\uff0c\u518d\u5c06Doublewrite Buffer\u4e2d\u7684\u9875\u5199\u5165\u78c1\u76d8\u6587\u4ef6\u3002<\/p>\n

\u6709\u4e86\u4e24\u6b21\u5199\u673a\u5236\uff0c\u5373\u4f7f\u5728\u5237\u810f\u9875\u65f6\u5b95\u673a\u4e86\uff0c\u5728\u5b9e\u4f8b\u6062\u590d\u7684\u65f6\u5019\u4e5f\u53ef\u4ee5\u4ece\u5171\u4eab\u8868\u7a7a\u95f4\u4e2d\u627e\u5230Doublewrite Buffer\u7684\u9875\u526f\u672c\uff0c\u76f4\u63a5\u5c06\u5176\u8986\u76d6\u539f\u6765\u7684\u6570\u636e\u9875\u5373\u53ef\u3002<\/p>\n

\u81ea\u9002\u5e94\u54c8\u5e0c\u7d22\u5f15<\/strong><\/div>\n

\u81ea\u9002\u5e94\u7d22\u5f15\u5c31\u8ddfJVM\u5728\u8fd0\u884c\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u52a8\u6001\u7684\u628a\u67d0\u4e9b\u70ed\u70b9\u4ee3\u7801\u7f16\u8bd1\u6210Machine Code\u4e00\u6837\uff0cInnoDB\u4f1a\u76d1\u63a7\u5bf9\u6240\u6709\u7d22\u5f15\u7684\u67e5\u8be2\uff0c\u5bf9\u70ed\u70b9\u8bbf\u95ee\u7684\u9875\u5efa\u7acb\u54c8\u5e0c\u7d22\u5f15\uff0c\u4ee5\u6b64\u6765\u63d0\u5347\u8bbf\u95ee\u901f\u5ea6\u3002<\/p>\n

\u4f60\u53ef\u80fd\u591a\u6b21\u770b\u5230\u4e86\u4e00\u4e2a\u5173\u952e\u5b57\u9875\uff0c\u63a5\u4e0b\u6765\u90a3\u6211\u4eec\u5c31\u6765\u804a\u4e00\u4e0b\u9875\u662f\u4ec0\u4e48?<\/p>\n

\u9875<\/strong><\/div>\n

\u9875\uff0c\u662fInnoDB\u4e2d\u6570\u636e\u7ba1\u7406\u7684\u6700\u5c0f\u5355\u4f4d\u3002\u5f53\u6211\u4eec\u67e5\u8be2\u6570\u636e\u65f6\uff0c\u5176\u662f\u4ee5\u9875\u4e3a\u5355\u4f4d\uff0c\u5c06\u78c1\u76d8\u4e2d\u7684\u6570\u636e\u52a0\u8f7d\u5230\u7f13\u51b2\u6c60\u4e2d\u7684\u3002\u540c\u7406\uff0c\u66f4\u65b0\u6570\u636e\u4e5f\u662f\u4ee5\u9875\u4e3a\u5355\u4f4d\uff0c\u5c06\u6211\u4eec\u5bf9\u6570\u636e\u7684\u4fee\u6539\u5237\u56de\u78c1\u76d8\u3002\u6bcf\u9875\u7684\u9ed8\u8ba4\u5927\u5c0f\u4e3a16k\uff0c\u6bcf\u9875\u4e2d\u5305\u542b\u4e86\u82e5\u5e72\u884c\u7684\u6570\u636e\uff0c\u9875\u7684\u7ed3\u6784\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n

\"\"<\/p>\n

\u4e0d\u7528\u592a\u7ea0\u7ed3\u6bcf\u4e2a\u533a\u662f\u5e72\u561b\u7684\uff0c\u6211\u4eec\u53ea\u9700\u8981\u77e5\u9053\u8fd9\u6837\u8bbe\u8ba1\u7684\u597d\u5904\u5728\u54ea\u513f\u3002\u6bcf\u4e00\u9875\u7684\u6570\u636e\uff0c\u53ef\u4ee5\u901a\u8fc7FileHeader\u4e2d\u7684\u4e0a\u4e00\u4e0b\u548c\u4e0b\u4e00\u9875\u7684\u6570\u636e\uff0c\u9875\u4e0e\u9875\u4e4b\u95f4\u53ef\u4ee5\u5f62\u6210\u53cc\u5411\u94fe\u8868\u3002\u56e0\u4e3a\u5728\u5b9e\u9645\u7684\u7269\u7406\u5b58\u50a8\u4e0a\uff0c\u6570\u636e\u5e76\u4e0d\u662f\u8fde\u7eed\u5b58\u50a8\u7684\u3002\u4f60\u53ef\u4ee5\u628a\u4ed6\u7406\u89e3\u6210G1\u7684Region\u5728\u5185\u5b58\u4e2d\u7684\u5206\u5e03\u3002<\/p>\n

\u800c\u4e00\u9875\u4e2d\u6240\u5305\u542b\u7684\u884c\u6570\u636e\uff0c\u884c\u4e0e\u884c\u4e4b\u95f4\u5219\u5f62\u6210\u4e86\u5355\u5411\u94fe\u8868\u3002\u6211\u4eec\u5b58\u5165\u7684\u884c\u6570\u636e\u6700\u7ec8\u4f1a\u5230User Records\u4e2d\uff0c\u5f53\u7136\u6700\u521dUser Records\u5e76\u4e0d\u5360\u636e\u4efb\u4f55\u5b58\u50a8\u7a7a\u95f4\u3002\u968f\u7740\u6211\u4eec\u5b58\u5165\u7684\u6570\u636e\u8d8a\u6765\u8d8a\u591a\uff0cUser Records\u4f1a\u8d8a\u6765\u8d8a\u5927\uff0cFree Space\u7684\u7a7a\u95f4\u4f1a\u8d8a\u6765\u8d8a\u5c0f\uff0c\u76f4\u5230\u88ab\u5360\u7528\u5b8c\uff0c\u5c31\u4f1a\u7533\u8bf7\u65b0\u7684\u6570\u636e\u9875\u3002<\/p>\n

User Records\u4e2d\u7684\u6570\u636e\uff0c\u662f\u6309\u7167\u4e3b\u952eid\u6765\u8fdb\u884c\u6392\u5e8f\u7684\uff0c\u5f53\u6211\u4eec\u6309\u7167\u4e3b\u952e\u6765\u8fdb\u884c\u67e5\u627e\u65f6\uff0c\u4f1a\u6cbf\u7740\u8fd9\u4e2a\u5355\u5411\u94fe\u8868\u4e00\u76f4\u5f80\u540e\u627e\uff0c<\/p>\n

\u91cd\u505a\u65e5\u5fd7\u7f13\u51b2<\/strong><\/div>\n

\u4e0a\u9762\u804a\u8fc7\uff0cInnoDB\u4e2d\u7f13\u51b2\u6c60\u4e2d\u7684\u9875\u6570\u636e\u66f4\u65b0\u4f1a\u5148\u4e8e\u78c1\u76d8\u6570\u636e\u66f4\u65b0\u7684\uff0cInnoDB\u4e5f\u4f1a\u91c7\u7528\u65e5\u5fd7\u5148\u884c(Write Ahead Log)\u7b56\u7565\u6765\u5237\u65b0\u6570\u636e\uff0c\u4ec0\u4e48\u610f\u601d\u5462?\u5f53\u4e8b\u52a1\u5f00\u59cb\u65f6\uff0c\u4f1a\u5148\u8bb0\u5f55Redo Log\u5230Redo Log Buffer\u4e2d\uff0c\u7136\u540e\u518d\u66f4\u65b0\u7f13\u51b2\u6c60\u9875\u6570\u636e\u3002<\/p>\n

Redo Log Buffer\u4e2d\u7684\u6570\u636e\u4f1a\u6309\u7167\u4e00\u5b9a\u7684\u9891\u7387\u5199\u5230\u91cd\u505a\u65e5\u5fd7\u4e2d\u53bb\u3002\u88ab\u66f4\u6539\u8fc7\u7684\u9875\u5c31\u4f1a\u88ab\u6807\u8bb0\u6210\u810f\u9875\uff0cInnoDB\u4f1a\u6839\u636eCheckPoint\u673a\u5236\u6765\u5c06\u810f\u9875\u5237\u5230\u78c1\u76d8\u3002<\/p>\n

\u65e5\u5fd7<\/strong><\/div>\n

\u4e0a\u9762\u63d0\u5230\u4e86Redo log\uff0c\u8fd9\u4e00\u5c0f\u8282\u5c31\u4e13\u95e8\u6765\u8bb2\u4e00\u8bb2\u65e5\u5fd7\uff0c\u65e5\u5fd7\u5206\u4e3a\u5982\u4e0b\u4e24\u4e2a\u7ef4\u5ea6\u3002<\/p>\n

MySQL\u5c42\u9762<\/p>\n

InnoDB\u5c42\u9762<\/p>\n

MySQL\u65e5\u5fd7<\/strong><\/div>\n

MySQL\u7684\u65e5\u5fd7\u53ef\u4ee5\u5206\u4e3a\u9519\u8bef\u65e5\u5fd7\u3001\u4e8c\u8fdb\u5236\u6587\u4ef6\u3001\u67e5\u8be2\u65e5\u5fd7\u548c\u6ee1\u67e5\u8be2\u65e5\u5fd7\u3002<\/p>\n

\u9519\u8bef\u65e5\u5fd7 \u5f88\u597d\u7406\u89e3\uff0c\u5c31\u662f\u670d\u52a1\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u53d1\u751f\u7684\u4e25\u91cd\u9519\u8bef\u65e5\u5fd7\u3002\u5f53\u6211\u4eec\u7684\u6570\u636e\u5e93\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u5c31\u53ef\u4ee5\u6765\u8fd9\u91cc\u770b\u770b\u5177\u4f53\u4e0d\u80fd\u542f\u52a8\u7684\u539f\u56e0\u662f\u4ec0\u4e48
\n\u4e8c\u8fdb\u5236\u6587\u4ef6 \u5b83\u6709\u53e6\u5916\u4e00\u4e2a\u540d\u5b57\u4f60\u5e94\u8be5\u719f\u6089\uff0c\u53ebBinlog\uff0c\u5176\u8bb0\u5f55\u4e86\u5bf9\u6570\u636e\u5e93\u6240\u6709\u7684\u66f4\u6539\u3002
\n\u67e5\u8be2\u65e5\u5fd7 \u8bb0\u5f55\u4e86\u6765\u81ea\u5ba2\u6237\u7aef\u7684\u6240\u6709\u8bed\u53e5
\n\u6162\u67e5\u8be2\u65e5\u5fd7 \u8fd9\u91cc\u8bb0\u5f55\u4e86\u6240\u6709\u54cd\u5e94\u65f6\u95f4\u8d85\u8fc7\u9608\u503c\u7684SQL\u8bed\u53e5\uff0c\u8fd9\u4e2a\u9608\u503c\u6211\u4eec\u53ef\u4ee5\u81ea\u5df1\u8bbe\u7f6e\uff0c\u53c2\u6570\u4e3along_query_time\uff0c\u5176\u9ed8\u8ba4\u503c\u4e3a10s\uff0c\u4e14\u9ed8\u8ba4\u662f\u5173\u95ed\u7684\u72b6\u6001\uff0c\u9700\u8981\u624b\u52a8\u7684\u6253\u5f00\u3002<\/p>\n

InnoDB\u65e5\u5fd7<\/strong><\/div>\n

InnoDB\u65e5\u5fd7\u5c31\u53ea\u6709\u4e24\u79cd\uff0cRedo Log\u548cUndo Log\uff0c<\/p>\n

Redo Log \u91cd\u505a\u65e5\u5fd7\uff0c\u7528\u4e8e\u8bb0\u5f55\u4e8b\u52a1\u64cd\u4f5c\u7684\u53d8\u5316\uff0c\u4e14\u8bb0\u5f55\u7684\u662f\u4fee\u6539\u4e4b\u540e\u7684\u503c\u3002\u4e0d\u7ba1\u4e8b\u52a1\u662f\u5426\u63d0\u4ea4\u90fd\u4f1a\u8bb0\u5f55\u4e0b\u6765\u3002\u4f8b\u5982\u5728\u66f4\u65b0\u6570\u636e\u65f6\uff0c\u4f1a\u5148\u5c06\u66f4\u65b0\u7684\u8bb0\u5f55\u5199\u5230Redo Log\u4e2d\uff0c\u518d\u66f4\u65b0\u7f13\u5b58\u4e2d\u9875\u4e2d\u7684\u6570\u636e\u3002\u7136\u540e\u6309\u7167\u8bbe\u7f6e\u7684\u66f4\u65b0\u7b56\u7565\uff0c\u5c06\u5185\u5b58\u4e2d\u7684\u6570\u636e\u5237\u56de\u78c1\u76d8\u3002
\nUndo Log \u8bb0\u5f55\u7684\u662f\u8bb0\u5f55\u7684\u4e8b\u52a1\u5f00\u59cb\u4e4b\u524d\u7684\u4e00\u4e2a\u7248\u672c\uff0c\u53ef\u7528\u4e8e\u4e8b\u52a1\u5931\u8d25\u4e4b\u540e\u53d1\u751f\u7684\u56de\u6eda\u3002
\nRedo Log\u8bb0\u5f55\u7684\u662f\u5177\u4f53\u67d0\u4e2a\u6570\u636e\u9875\u4e0a\u7684\u4fee\u6539\uff0c\u53ea\u80fd\u5728\u5f53\u524dServer\u4f7f\u7528\uff0c\u800cBinlog\u53ef\u4ee5\u7406\u89e3\u4e3a\u53ef\u4ee5\u7ed9\u5176\u4ed6\u7c7b\u578b\u7684\u5b58\u50a8\u5f15\u64ce\u4f7f\u7528\u3002\u8fd9\u4e5f\u662fBinlog\u7684\u4e00\u4e2a\u91cd\u8981\u4f5c\u7528\uff0c\u90a3\u5c31\u662f\u4e3b\u4ece\u590d\u5236\uff0c\u53e6\u5916\u4e00\u4e2a\u4f5c\u7528\u662f\u6570\u636e\u6062\u590d\u3002<\/p>\n

\u4e0a\u9762\u63d0\u5230\u8fc7\uff0cBinlog\u4e2d\u8bb0\u5f55\u4e86\u6240\u6709\u5bf9\u6570\u636e\u5e93\u7684\u4fee\u6539\uff0c\u5176\u8bb0\u5f55\u65e5\u5fd7\u6709\u4e09\u79cd\u683c\u5f0f\u3002\u5206\u522b\u662fStatement\u3001Row\u548cMixedLevel\u3002<\/p>\n

Statement \u8bb0\u5f55\u6240\u6709\u4f1a\u4fee\u6539\u6570\u636e\u7684SQL\uff0c\u5176\u53ea\u4f1a\u8bb0\u5f55SQL\uff0c\u5e76\u4e0d\u9700\u8981\u8bb0\u5f55\u4e0b\u8fd9\u4e2aSQL\u5f71\u54cd\u7684\u6240\u6709\u884c\uff0c\u51cf\u5c11\u4e86\u65e5\u5fd7\u91cf\uff0c\u63d0\u9ad8\u4e86\u6027\u80fd\u3002\u4f46\u662f\u7531\u4e8e\u53ea\u662f\u8bb0\u5f55\u6267\u884c\u8bed\u53e5\uff0c\u4e0d\u80fd\u4fdd\u8bc1\u5728Slave\u8282\u70b9\u4e0a\u80fd\u591f\u6b63\u786e\u6267\u884c\uff0c\u6240\u4ee5\u8fd8\u9700\u8981\u989d\u5916\u7684\u8bb0\u5f55\u4e00\u4e9b\u4e0a\u4e0b\u6587\u4fe1\u606f
\nRow \u53ea\u4fdd\u5b58\u88ab\u4fee\u6539\u7684\u8bb0\u5f55\uff0c\u4e0eStatement\u53ea\u8bb0\u5f55\u6267\u884cSQL\u6765\u6bd4\u8f83\uff0cRow\u4f1a\u4ea7\u751f\u5927\u91cf\u7684\u65e5\u5fd7\u3002\u4f46\u662fRow\u4e0d\u7528\u8bb0\u5f55\u4e0a\u4e0b\u6587\u4fe1\u606f\u4e86\uff0c\u53ea\u9700\u8981\u5173\u6ce8\u88ab\u6539\u6210\u5565\u6837\u5c31\u884c\u3002
\nMixedLevel \u5c31\u662fStatement\u548cRow\u6df7\u5408\u4f7f\u7528\u3002
\n\u5177\u4f53\u4f7f\u7528\u54ea\u79cd\u65e5\u5fd7\uff0c\u9700\u8981\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u6765\u51b3\u5b9a\u3002\u4f8b\u5982\u4e00\u6761UPDATE\u8bed\u53e5\u66f4\u65b0\u4e86\u5f88\u591a\u7684\u6570\u636e\uff0c\u91c7\u7528Statement\u4f1a\u66f4\u52a0\u8282\u7701\u7a7a\u95f4\uff0c\u4f46\u662f\u76f8\u5bf9\u7684\uff0cRow\u4f1a\u66f4\u52a0\u7684\u53ef\u9760\u3002<\/p>\n

InnoDB\u548cMyISAM\u7684\u533a\u522b<\/strong><\/div>\n

\u7531\u4e8eMyISAM\u5e76\u4e0d\u5e38\u7528\uff0c\u6211\u4e5f\u4e0d\u6253\u7b97\u53bb\u6df1\u7a76\u5176\u5e95\u5c42\u7684\u4e00\u4e9b\u539f\u7406\u548c\u5b9e\u73b0\u3002\u6211\u4eec\u5728\u8fd9\u91cc\u7b80\u5355\u7684\u5bf9\u6bd4\u4e00\u4e0b\u8fd9\u4e24\u4e2a\u5b58\u50a8\u5f15\u64ce\u7684\u533a\u522b\u5c31\u597d\u3002\u6211\u4eec\u5206\u70b9\u6765\u4e00\u70b9\u70b9\u63cf\u8ff0\u3002<\/p>\n

\u4e8b\u52a1 InnoDB\u652f\u6301\u4e8b\u52a1\u3001\u56de\u6eda\u3001\u4e8b\u52a1\u5b89\u5168\u548c\u5954\u6e83\u6062\u590d\u3002\u800cMyISAM\u4e0d\u652f\u6301\uff0c\u4f46\u67e5\u8be2\u7684\u901f\u5ea6\u8981\u6bd4InnoDB\u66f4\u5feb
\n\u4e3b\u952e InnoDB\u89c4\u5b9a\uff0c\u5982\u679c\u6ca1\u6709\u8bbe\u7f6e\u4e3b\u952e\uff0c\u5c31\u81ea\u52a8\u7684\u751f\u6210\u4e00\u4e2a6\u5b57\u8282\u7684\u4e3b\u952e\uff0c\u800cMyISAM\u5141\u8bb8\u6ca1\u6709\u4efb\u4f55\u7d22\u5f15\u548c\u4e3b\u952e\u7684\u5b58\u5728\uff0c\u7d22\u5f15\u5c31\u662f\u884c\u7684\u5730\u5740
\n\u5916\u952e InnoDB\u652f\u6301\u5916\u952e\uff0c\u800cMyISAM\u4e0d\u652f\u6301
\n\u8868\u9501 InnoDB\u652f\u6301\u884c\u9501\u548c\u8868\u9501\uff0c\u800cMyISAM\u53ea\u652f\u6301\u8868\u9501
\n\u5168\u6587\u7d22\u5f15 InnoDB\u4e0d\u652f\u6301\u5168\u6587\u7d22\u5f15\uff0c\u4f46\u662f\u53ef\u4ee5\u7528\u63d2\u4ef6\u6765\u5b9e\u73b0\u76f8\u5e94\u7684\u529f\u80fd\uff0c\u800cMyISAM\u662f\u672c\u8eab\u5c31\u652f\u6301\u5168\u672c\u7d22\u5f15
\n\u884c\u6570 InnoDB\u83b7\u53d6\u884c\u6570\u65f6\uff0c\u9700\u8981\u626b\u5168\u8868\u3002\u800cMyISAM\u4fdd\u5b58\u4e86\u5f53\u524d\u8868\u7684\u603b\u884c\u6570\uff0c\u76f4\u63a5\u8bfb\u53d6\u5373\u53ef\u3002
\n\u6240\u4ee5\uff0c\u7b80\u5355\u603b\u7ed3\u4e00\u4e0b\uff0cMyISAM\u53ea\u9002\u7528\u4e8e\u67e5\u8be2\u5927\u4e8e\u66f4\u65b0\u7684\u573a\u666f\uff0c\u5982\u679c\u4f60\u7684\u7cfb\u7edf\u67e5\u8be2\u7684\u60c5\u51b5\u5360\u7edd\u5927\u591a\u6570(\u4f8b\u5982\u62a5\u8868\u7cfb\u7edf)\u5c31\u53ef\u4ee5\u4f7f\u7528MyISAM\u6765\u5b58\u50a8\uff0c\u9664\u6b64\u4e4b\u5916\uff0c\u90fd\u5efa\u8bae\u4f7f\u7528InnoDB\u3002<\/p>\n

End<\/strong><\/div>\n

\u7531\u4e8e\u65f6\u95f4\u7684\u539f\u56e0\uff0c\u672c\u6587\u53ea\u662f\u7b80\u5355\u7684\u804a\u4e86\u804aInnoDB\u7684\u6574\u4f53\u67b6\u6784\uff0c\u5e76\u6ca1\u6709\u5f88\u6df1\u5165\u7684\u53bb\u804a\u67d0\u4e9b\u70b9\u3002\u4f8b\u5982InnoDB\u662f\u5982\u4f55\u6539\u8fdb\u6765\u89e3\u51b3\u7f13\u51b2\u6c60\u6c61\u67d3\u7684\uff0c\u5176\u7b97\u6cd5\u5177\u4f53\u662f\u4ec0\u4e48\uff0ccheckpoint\u662f\u5982\u4f55\u5de5\u4f5c\u7684\u7b49\u7b49\uff0c\u53ea\u662f\u505a\u4e00\u4e2a\u7b80\u5355\u7684\u4e86\u89e3\uff0c\u4e4b\u540e\u5982\u679c\u6709\u65f6\u95f4\u7684\u8bdd\u518d\u7ec6\u804a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5f88\u591a\u6587\u7ae0\u90fd\u662f\u76f4\u63a5\u5f00\u59cb\u4ecb\u7ecd\u6709\u54ea\u4e9b\u5b58\u50a8\u5f15\u64ce\uff0c\u5e76\u6ca1\u6709\u53bb\u4ecb\u7ecd\u5b58\u50a8\u5f15\u64ce\u672c\u8eab\u3002\u90a3\u4e48\u7a76\u7adf\u4ec0\u4e48\u662f\u5b58\u50a8\u5f15\u64ce?\u4e0d\u77e5\u9053\u5927\u5bb6\u6709\u6ca1\u6709\u60f3\u8fc7 […]<\/p>\n","protected":false},"author":1898,"featured_media":197403,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[590],"class_list":["post-197398","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread","tag-innodb"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/197398","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1898"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=197398"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/197398\/revisions"}],"predecessor-version":[{"id":199715,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/197398\/revisions\/199715"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/197403"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=197398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=197398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=197398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}