{"id":3719,"date":"2019-07-29T23:27:55","date_gmt":"2019-07-29T15:27:55","guid":{"rendered":"https:\/\/damogame.cn\/wordpress\/?p=3719"},"modified":"2019-07-29T23:27:55","modified_gmt":"2019-07-29T15:27:55","slug":"innodb%e7%b4%a2%e5%bc%95%e6%9c%80%e9%80%9a%e4%bf%97%e7%9a%84%e8%a7%a3%e9%87%8a","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/3719","title":{"rendered":"InnoDB\u7d22\u5f15\u6700\u901a\u4fd7\u7684\u89e3\u91ca"},"content":{"rendered":"<div class=\"article-header-box\">\n<div class=\"article-header\">\n<div class=\"article-title-box\"><\/div>\n<div class=\"article-info-box\">\n<div class=\"article-bar-top\">\n<div class=\"tags-box space\"><a href=\"https:\/\/blog.csdn.net\/u010710458\/article\/details\/80209909\">\u539f\u6587\u5730\u5740<\/a><\/div>\n<\/div>\n<div class=\"operating\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<article class=\"baidu_pl\">\n<div id=\"article_content\" class=\"article_content clearfix\" data-report-click=\"{&quot;mod&quot;:&quot;popu_307&quot;,&quot;dest&quot;:&quot;https:\/\/blog.csdn.net\/u010710458\/article\/details\/80209909&quot;}\">\n<div class=\"article-copyright\">\u00a0\u7248\u6743\u58f0\u660e\uff1a\u672c\u6587\u4e3a\u535a\u4e3b\u539f\u521b\u6587\u7ae0\uff0c\u672a\u7ecf\u535a\u4e3b\u5141\u8bb8\u968f\u610f\u8f6c\u8f7d\u3002 https:\/\/blog.csdn.net\/u010710458\/article\/details\/80209909<\/div>\n<div id=\"content_views\" class=\"markdown_views\">\n<h1 id=\"\u4ec0\u4e48\u662f\u7d22\u5f15\"><a name=\"t0\"><\/a>\u4ec0\u4e48\u662f\u7d22\u5f15<\/h1>\n<p><strong>\u7d22\u5f15\u662f\u4e00\u79cd\u7279\u6b8a\u7684\u6587\u4ef6(<code>InnoDB<\/code>\u6570\u636e\u8868\u4e0a\u7684\u7d22\u5f15\u662f\u8868\u7a7a\u95f4\u7684\u4e00\u4e2a\u7ec4\u6210\u90e8\u5206)\u5185\u90e8\u6570\u636e\u7ed3\u6784\u4f7f\u7528\u7684B+\u6811\uff0cB\u6811\u8282\u70b9\u5185\u90e8\u5305\u542b\u7740\u5bf9\u6570\u636e\u8868\u91cc\u6240\u6709\u8bb0\u5f55\u7684\u5f15\u7528\u6307\u9488<\/strong>\u3002\u66f4\u901a\u4fd7\u7684\u8bf4\uff0c\u6570\u636e\u5e93\u7d22\u5f15\u597d\u6bd4\u662f\u4e00\u672c\u4e66\u524d\u9762\u7684\u76ee\u5f55\uff0c\u80fd\u52a0\u5feb\u6570\u636e\u5e93\u7684\u67e5\u8be2\u901f\u5ea6\u3002\u4e0a\u8ff0SQL\u8bed\u53e5\uff0c\u5728\u6ca1\u6709\u7d22\u5f15\u7684\u60c5\u51b5\u4e0b\uff0c\u6570\u636e\u5e93\u4f1a\u904d\u5386\u5168\u90e8\u6570\u636e\u540e\u9009\u62e9\u7b26\u5408\u6761\u4ef6\u7684\uff1b\u800c\u6709\u4e86\u76f8\u5e94\u7684\u7d22\u5f15\u4e4b\u540e\uff0c\u6570\u636e\u5e93\u4f1a\u76f4\u63a5\u5148\u5728\u7d22\u5f15\u4e2d\u67e5\u627e\u7b26\u5408\u6761\u4ef6\u7684\u9009\u9879\u3002\u5982\u679c\u6211\u4eec\u628aSQL\u8bed\u53e5\u6362\u6210\u201cSELECT * FROM article WHERE id=2000000\u201d\uff0c\u90a3\u4e48\u4f60\u662f\u5e0c\u671b\u6570\u636e\u5e93\u6309\u7167\u987a\u5e8f\u8bfb\u53d6\u5b8c200\u4e07\u884c\u6570\u636e\u4ee5\u540e\u7ed9\u4f60\u7ed3\u679c\u8fd8\u662f\u76f4\u63a5\u5728\u7d22\u5f15\u4e2d\u5b9a\u4f4d\u5462\uff1f\uff08\u6ce8\uff1a\u4e00\u822c\u6570\u636e\u5e93\u9ed8\u8ba4\u90fd\u4f1a\u4e3a\u4e3b\u952e\u751f\u6210\u7d22\u5f15\uff09\u3002<\/p>\n<h1 id=\"\u6811\"><a name=\"t1\"><\/a>\u6811<\/h1>\n<p>\u4e8c\u53c9\u67e5\u627e\u6811\uff08Binary Search Tree\uff09\uff0c\u5e73\u8861\u4e8c\u53c9\u67e5\u627e\u6811\uff08Balanced Binary Search Tree\uff09\uff0c\u7ea2\u9ed1\u6811(Red-Black Tree )\uff0cB-tree\u548cB+-tree\u3002\u524d\u4e09\u8005\u662f\u5178\u578b\u7684\u4e8c\u53c9\u67e5\u627e\u6811\u7ed3\u6784\uff0c\u5176\u67e5\u627e\u7684\u65f6\u95f4\u590d\u6742\u5ea6O(log2N)\u4e0e\u6811\u7684\u6df1\u5ea6\u76f8\u5173\uff0c\u90a3\u4e48\u964d\u4f4e\u6811\u7684\u6df1\u5ea6\u81ea\u7136\u4f1a\u63d0\u9ad8\u67e5\u627e\u6548\u7387\u3002<\/p>\n<p><strong>\u4e8c\u53c9\u67e5\u627e\u6811<\/strong>\uff1a\u5de6\u5b50\u6811\u952e\u503c\u603b\u662f\u5c0f\u4e8e\u6839\u7684\u952e\u503c\uff0c\u53f3\u5b50\u6811\u952e\u503c\u603b\u662f\u5927\u4e8e\u6839\u7684\u952e\u503c\u3002\u56e0\u6b64\u4e2d\u5e8f\u904d\u5386\u53ef\u4ee5\u5f97\u5230\u952e\u503c\u7684\u6392\u5e8f\u8f93\u51fa\u3002<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20180506180432987?watermark\/2\/text\/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTA3MTA0NTg=\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><br \/>\n\u4e0a\u8ff0\u4e2d\u5e8f\u8f93\u51fa\u5c31\u662f\uff1a2 3 5 6 7 8\u3002<br \/>\n\u4f46\u662f\u4e8c\u53c9\u67e5\u627e\u6811\u53ef\u4ee5\u4ee5\u4efb\u610f\u7684\u987a\u5e8f\u63d2\u5165\uff0c\u4f8b\u5982\u5f53\u6570\u636e2 3 5 6 7 8\u4ee5\u6709\u5e8f\u7684\u987a\u5e8f\u63d2\u5165\u65f6\u5019\uff0c\u6811\u7684\u7ed3\u6784\u5c31\u662f\u4e0b\u56fe\uff1a<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20180506180943360?watermark\/2\/text\/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTA3MTA0NTg=\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><br \/>\n\u53ef\u4ee5\u770b\u5230\u6811\u5df2\u7ecf\u51fa\u73b0\u4e86\u6781\u5ea6\u4e0d\u5e73\u8861\uff0c\u67e5\u627e\u901f\u5ea6\u4e00\u5b9a\u548c\u7ebf\u6027\u67e5\u627e\u4e00\u6837\u4e86\u3002\u4e3a\u4e86\u89e3\u51b3\u4e0a\u8ff0\u95ee\u9898\uff0c\u51fa\u73b0\u4e86\u540e\u7eed\u7684\u6811\u79cd\u3002<\/p>\n<p><strong>\u5e73\u8861\u4e8c\u53c9\u6811<\/strong>\uff1a\u4e3a\u4e86\u63d0\u9ad8\u4e8c\u53c9\u6811\u7684\u641c\u7d22\u7684\u6548\u7387,\u51cf\u5c11\u6811\u7684\u5e73\u5747\u641c\u7d22\u957f\u5ea6\uff0c\u63d0\u51fa\u4e86AVL\u6811\uff0c<strong>\u5b83\u7684\u5de6\u5b50\u6811\u548c\u53f3\u5b50\u6811\u7684\u6df1\u5ea6\u4e4b\u5dee(\u5e73\u8861\u56e0\u5b50)\u7684\u7edd\u5bf9\u503c\u4e0d\u8d85\u8fc71\uff08\u4e5f\u5c31\u662f\u9ad8\u5ea6\u7684\u5e73\u8861\uff09\uff0c<\/strong>\u4e14\u5b83\u7684\u5de6\u5b50\u6811\u548c\u53f3\u5b50\u6811\u90fd\u662f\u4e00\u9897\u5e73\u8861\u4e8c\u53c9\u6811\u3002<strong>\u4e3a\u4e86\u7ef4\u6301\u9ad8\u5ea6\u7684\u5e73\u8861\uff0c\u5219\u9891\u7e41\u7684\u63d2\u5165\u548c\u5220\u9664\uff0c\u4f1a\u5f15\u8d77\u9891\u7e41\u7684reblance\uff08\u65cb\u8f6c\u4ee5\u7ef4\u6301\u5e73\u8861\uff09\uff0c\u5bfc\u81f4\u6548\u7387\u53ef\u80fd\u4f1a\u4e0b\u964d\u3002<\/strong>\u5177\u4f53\u4ee3\u7801\u5982\u4f55\u7f16\u5199\uff0c\u6682\u4e0d\u8003\u8651\uff0c\u56e0\u4e3a\u6bcf\u4ec0\u4e48\u7528\u3002<\/p>\n<p><strong>\u7ea2\u9ed1\u6811<\/strong>\uff1a\u7ea2\u9ed1\u6811\uff0c\u4e00\u79cd\u4e8c\u53c9\u67e5\u627e\u6811\uff0c\u4f46\u5728\u6bcf\u4e2a\u7ed3\u70b9\u4e0a\u589e\u52a0\u4e00\u4e2a\u5b58\u50a8\u4f4d\u8868\u793a\u7ed3\u70b9\u7684\u989c\u8272\uff0c\u53ef\u4ee5\u662fRed\u6216Black\u3002\u901a\u8fc7\u5bf9\u4efb\u4f55\u4e00\u6761\u4ece\u6839\u5230\u53f6\u5b50\u7684\u8def\u5f84\u4e0a\u5404\u4e2a\u7ed3\u70b9\u7740\u8272\u65b9\u5f0f\u7684\u9650\u5236\uff0c<strong>\u7ea2\u9ed1\u6811\u727a\u7272\u4e86\u7edd\u5bf9\u5e73\u8861\uff0c\u6362\u53d6\u4e86\u5c11\u65cb\u8f6c\u3002\u7ea2\u9ed1\u6811\u786e\u4fdd\u6ca1\u6709\u4e00\u6761\u8def\u5f84\u4f1a\u6bd4\u5176\u4ed6\u8def\u5f84\u957f\u51fa\u4fe9\u500d\uff0c\u4e14\u5bf9\u4e8e\u4efb\u610f\u7ed3\u70b9\u800c\u8a00\uff0c\u5176\u5230\u53f6\u7ed3\u70b9\u6811\u5c3e\u7aefNIL\u6307\u9488\u7684\u6bcf\u6761\u8def\u5f84\u90fd\u5305\u542b\u76f8\u540c\u6570\u76ee\u7684\u9ed1\u7ed3\u70b9\uff0c\u56e0\u800c\u662f\u63a5\u8fd1\u5e73\u8861\u7684\u3002<\/strong><br \/>\n\u7ea2\u9ed1\u6811\u4e0d\u662f\u9ad8\u5ea6\u5e73\u8861\u7684\uff0c\u7b97\u662f\u4e00\u79cd\u6298\u4e2d\uff0c\u63d2\u5165\u6700\u591a\u4e24\u6b21\u65cb\u8f6c\uff0c\u5220\u9664\u6700\u591a\u4e09\u6b21\u65cb\u8f6c\u3002\u5f88\u597d\u7684\u89e3\u51b3\u4e86\u5e73\u8861\u4e8c\u53c9\u6811\u65cb\u8f6c\u6b21\u6570\u51fa\u73b0\u5f88\u591a\u7684\u53ef\u80fd\u3002<\/p>\n<p>\u7ea2\u9ed1\u6811\u5177\u67095\u4e2a\u6027\u8d28\uff1a<\/p>\n<ul>\n<li>\u6bcf\u4e2a\u7ed3\u70b9\u8981\u4e48\u662f\u7ea2\u7684\u8981\u4e48\u662f\u9ed1\u7684\u3002<\/li>\n<li>\u6839\u7ed3\u70b9\u662f\u9ed1\u7684\u3002<\/li>\n<li>\u6bcf\u4e2a\u53f6\u7ed3\u70b9\uff08\u53f6\u7ed3\u70b9\u5373\u6307\u6811\u5c3e\u7aefNIL\u6307\u9488\u6216NULL\u7ed3\u70b9\uff09\u90fd\u662f\u9ed1\u7684\u3002<\/li>\n<li>\u5982\u679c\u4e00\u4e2a\u7ed3\u70b9\u662f\u7ea2\u7684\uff0c\u90a3\u4e48\u5b83\u7684\u4e24\u4e2a\u513f\u5b50\u90fd\u662f\u9ed1\u7684\u3002<\/li>\n<li>\u5bf9\u4e8e\u4efb\u610f\u7ed3\u70b9\u800c\u8a00\uff0c\u5176\u5230\u53f6\u7ed3\u70b9\u6811\u5c3e\u7aefNIL\u6307\u9488\u7684\u6bcf\u6761\u8def\u5f84\u90fd\u5305\u542b\u76f8\u540c\u6570\u76ee\u7684\u9ed1\u7ed3\u70b9\u3002<\/li>\n<\/ul>\n<p>\u6b63\u662f\u7ea2\u9ed1\u6811\u7684\u8fd95\u6761\u6027\u8d28\uff0c\u4f7f\u4e00\u68f5n\u4e2a\u7ed3\u70b9\u7684\u7ea2\u9ed1\u6811\u59cb\u7ec8\u4fdd\u6301\u4e86logn\u7684\u9ad8\u5ea6\uff0c\u4ece\u800c\u4e5f\u5c31\u89e3\u91ca\u4e86\u4e0a\u9762\u6240\u8bf4\u7684\u201c\u7ea2\u9ed1\u6811\u7684\u67e5\u627e\u3001<strong>\u63d2\u5165\u3001\u5220\u9664\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u6700\u574f\u4e3aO(log n)<\/strong>\u3002\u5177\u4f53\u5982\u4f55\u63d2\u5165\u3001\u67e5\u627e\u3001\u5220\u9664\uff0c\u5c31\u6839\u672c\u4e0d\u9700\u8981\u8003\u8651\u4e86\uff0c\u5b9e\u73b0\u8d77\u6765\u76f8\u5f53\u7684\u590d\u6742\u3002<\/p>\n<p><strong>B\u6811<\/strong>\uff1aB\u6811\u53c8\u53eb\u505a\u591a\u53c9\u5e73\u8861\u67e5\u627e\u6811\u3002\u524d\u9762\u7684\u5e73\u8861\u4e8c\u53c9\u6811\u5206\u652f\u6700\u591a\u67092\u4e2a\uff0c\u4f46\u662f\u8fd9\u91cc\u7684B\u6811\u5206\u652f\u53ef\u4ee5\u6709n\u4e2a\u3002\u5206\u652f\u591a\u7684\u597d\u5904\u5c31\u4f1a\u5f62\u6210\u4e00\u4e2a\u77ee\u80d6\u77ee\u80d6\u7684\u5e73\u8861\u4e8c\u53c9\u6811\u3002\u6bcf\u4e2a\u8282\u70b9\u91cc\u9762\u542b\u6709\u8bb8\u591a\u4e2a\u952e-\u503c\u5bf9\u3002\u8fd9\u5c31\u662fB\u6811\u3002\u00a0<strong>B\u6811\u4e2d\u7684\u6bcf\u4e2a\u7ed3\u70b9\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u53ef\u4ee5\u5305\u542b\u5927\u91cf\u7684\u5173\u952e\u5b57\u4fe1\u606f\u548c\u5206\u652f(\u5f53\u7136\u662f\u4e0d\u80fd\u8d85\u8fc7\u78c1\u76d8\u5757\u7684\u5927\u5c0f\uff0c\u6839\u636e\u78c1\u76d8\u9a71\u52a8(disk drives)\u7684\u4e0d\u540c\uff0c\u4e00\u822c\u5757\u7684\u5927\u5c0f\u57281k~4k\u5de6\u53f3)\uff1b\u8fd9\u6837\u6811\u7684\u6df1\u5ea6\u964d\u4f4e\u4e86\uff0c\u8fd9\u5c31\u610f\u5473\u7740\u67e5\u627e\u4e00\u4e2a\u5143\u7d20\u53ea\u8981\u5f88\u5c11\u7ed3\u70b9\u4ece\u5916\u5b58\u78c1\u76d8\u4e2d\u8bfb\u5165\u5185\u5b58\uff0c\u5f88\u5feb\u8bbf\u95ee\u5230\u8981\u67e5\u627e\u7684\u6570\u636e<\/strong>\u3002<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20180506201605250?watermark\/2\/text\/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTA3MTA0NTg=\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><br \/>\n\u4e0a\u8ff0\u5c31\u662f\u4e00\u4e2aB\u6811\u3002<br \/>\n\u5916\u90e8\u5b58\u50a8\u4e0d\u540c\u4e8e\u5185\u5b58\u7684\u4e3b\u8981\u7279\u6027\u5c31\u662f\u9700\u8981\u82b1\u8d39\u5f88\u591a\u7684\u65f6\u95f4\u53bb\u5b9a\u4f4d\u7279\u5b9a\u7684\u9875\uff0c\u4f46\u662f\u9875\u8bfb\u53d6\u6570\u636e\u975e\u5e38\u5feb\u3002\u6240\u4ee5\u9700\u8981\u4f7f\u7528\u6700\u5c11\u7684\u65f6\u95f4\u6765\u5b9a\u4f4d\u5230\u76f8\u5e94\u7684\u9875\u3002<\/p>\n<p>\u5bf9\u4e8e\u5728\u5916\u5b58\u50a8\u5668-\u78c1\u76d8\u4e0a\u9762\u7684\u6570\u636e\u4f7f\u7528\u8fd9\u79cd\u6811\uff0c\u53ef\u4ee5\u6700\u5927\u7a0b\u5ea6\u7684\u51cf\u5c11IO\u64cd\u4f5c\u3002<\/p>\n<p><strong>B+\u6811<\/strong>\uff1a\u662fB\u6811\u7684\u53d8\u4f53\u3002B+-tree\u7684\u5185\u90e8\u7ed3\u70b9\u5e76\u6ca1\u6709\u6307\u5411\u5173\u952e\u5b57\u5177\u4f53\u4fe1\u606f\u7684\u6307\u9488\uff0c\u53ea\u6709\u5728\u53f6\u5b50\u8282\u70b9\u624d\u4f1a\u6709\u6bcf\u4e2a\u5173\u952e\u5b57\u5177\u4f53\u4fe1\u606f\uff0c\u4e14\u6bcf\u4e2a\u8282\u70b9\u5185\u90e8\u542b\u6709\u952e\u503c\u7684\u5197\u4f59\u3002\u56e0\u6b64\u5176\u5185\u90e8\u7ed3\u70b9\u76f8\u5bf9B\u6811\u66f4\u5c0f\u3002\u5982\u679c\u628a\u6240\u6709\u540c\u4e00\u5185\u90e8\u7ed3\u70b9\u7684\u5173\u952e\u5b57\u5b58\u653e\u5728\u540c\u4e00\u76d8\u5757\u4e2d\uff0c\u90a3\u4e48\u76d8\u5757\u6240\u80fd\u5bb9\u7eb3\u7684\u5173\u952e\u5b57\u6570\u91cf\u4e5f\u8d8a\u591a\u3002\u4e00\u6b21\u6027\u8bfb\u5165\u5185\u5b58\u4e2d\u7684\u9700\u8981\u67e5\u627e\u7684\u5173\u952e\u5b57\u4e5f\u5c31\u8d8a\u591a\u3002\u76f8\u5bf9\u6765\u8bf4IO\u8bfb\u5199\u6b21\u6570\u4e5f\u5c31\u964d\u4f4e\u4e86\u3002<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20180506202550501?watermark\/2\/text\/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTA3MTA0NTg=\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><br \/>\n\u5982\u4e0a\u662f\u4e00\u9897B+\u6811\uff0c\u9664\u4e86\u53f6\u5b50\u8282\u70b9\u4e4b\u5916\u8282\u70b9\u5185\u90e8\u4ec5\u4ec5\u542b\u6709\u952e\u800c\u5df2\u3002\u5230\u4e86\u6700\u540e\u53f6\u5b50\u8282\u70b9\u91cc\u9762\u624d\u542b\u6709\u6bcf\u4e2a\u952e\u5bf9\u5e94\u7684\u503c\uff08\u6307\u9488\u6307\u5411\u5173\u952e\u4fe1\u606f\uff09\u4fe1\u606f\u3002<\/p>\n<p>B+\u6811\u7279\u70b9\uff1a<\/p>\n<ul>\n<li>\u6240\u6709\u7684\u53f6\u5b50\u7ed3\u70b9\u4e2d\u5305\u542b\u4e86\u5168\u90e8\u5143\u7d20\u7684\u4fe1\u606f\uff0c\u53ca\u6307\u5411\u542b\u8fd9\u4e9b\u5143\u7d20\u8bb0\u5f55\u7684\u6307\u9488\uff0c\u4e14\u53f6\u5b50\u7ed3\u70b9\u672c\u8eab\u4f9d\u5173\u952e\u5b57\u7684\u5927\u5c0f\u81ea\u5c0f\u800c\u5927\u987a\u5e8f\u94fe\u63a5\u3002<\/li>\n<li>\u6240\u6709\u7684\u4e2d\u95f4\u8282\u70b9\u5143\u7d20\u90fd\u540c\u65f6\u5b58\u5728\u4e8e\u5b50\u8282\u70b9\uff0c\u5728\u5b50\u8282\u70b9\u5143\u7d20\u4e2d\u662f\u6700\u5927\uff08\u6216\u6700\u5c0f\uff09\u5143\u7d20\u3002<\/li>\n<\/ul>\n<p>B+\u6811\u7684\u4f18\u70b9\uff1a<\/p>\n<ul>\n<li>\u5355\u4e00\u8282\u70b9\u5b58\u50a8\u66f4\u591a\u7684\u5143\u7d20\uff08\u56e0\u4e3a\u4e0d\u542b\u6709\u5bf9\u5e94\u7684\u503c\uff0c\u4ec5\u4ec5\u542b\u6709\u952e\uff09\uff0c\u4f7f\u5f97\u67e5\u8be2\u7684IO\u6b21\u6570\u66f4\u5c11\u3002<\/li>\n<li>\u6240\u6709\u67e5\u8be2\u90fd\u8981\u4ece\u6839\u8282\u70b9\u67e5\u627e\u5230\u53f6\u5b50\u8282\u70b9\uff0c\u67e5\u8be2\u6027\u80fd\u7a33\u5b9a\uff0c\u76f8\u5bf9\u4e8eB\u6811\u66f4\u52a0\u7a33\u5b9a\uff0c\u4ee5\u4e3aB+\u6811\u53ea\u6709\u53f6\u5b50\u8282\u70b9\u5b58\u50a8\u4e86\u5bf9\u5e94\u7684\u503c\u4fe1\u606f\u3002<\/li>\n<li>\u6240\u6709\u53f6\u5b50\u8282\u70b9\u5f62\u6210\u6709\u5e8f\u53cc\u5411\u94fe\u8868\uff0c\u5bf9\u4e8eSQL\u7684\u8303\u56f4\u67e5\u8be2\u4ee5\u53ca\u6392\u5e8f\u67e5\u8be2\u90fd\u5f88\u65b9\u4fbf\u3002<\/li>\n<li>B\/B+\u6811\u7684\u5171\u540c\u4f18\u70b9\u7684\u6bcf\u4e2a\u8282\u70b9\u6709\u66f4\u591a\u7684\u5b69\u5b50\uff0c\u63d2\u5165\u4e0d\u9700\u8981\u6539\u53d8\u6811\u7684\u9ad8\u5ea6\uff0c\u4ece\u800c\u51cf\u5c11\u91cd\u65b0\u5e73\u8861\u7684\u6b21\u6570\uff0c\u975e\u5e38\u9002\u5408\u505a\u6570\u636e\u5e93\u7d22\u5f15\u8fd9\u79cd\u9700\u8981\u6301\u4e45\u5316\u5728\u78c1\u76d8\uff0c\u540c\u65f6\u9700\u8981\u5927\u91cf\u67e5\u8be2\u548c\u63d2\u5165\u7684\u5e94\u7528\u3002\u6811\u4e2d\u8282\u70b9\u5b58\u50a8\u8fd9\u6307\u5411\u9875\u7684\u4fe1\u606f\uff0c\u53ef\u4ee5\u5feb\u901f\u5b9a\u4f4d\u5230\u78c1\u76d8\u5bf9\u5e94\u7684\u9875\u4e0a\u9762\u3002<\/li>\n<\/ul>\n<h1 id=\"innodb\u7d22\u5f15\u5b9e\u73b0\"><a name=\"t2\"><\/a>InnoDB\u7d22\u5f15\u5b9e\u73b0<\/h1>\n<p>B+\u6811\u7d22\u5f15\u5e76\u4e0d\u80fd\u627e\u5230\u4e00\u4e2a\u7ed9\u5b9a\u952e\u503c\u7684\u5177\u4f53\u884c\u3002B+\u6811\u7d22\u5f15\u80fd\u627e\u5230\u7684\u53ea\u662f\u88ab\u67e5\u627e\u6570\u636e\u884c\u6240\u5728\u7684\u9875\u3002\u7136\u540e\u6570\u636e\u5e93\u901a\u8fc7\u628a\u9875\u8bfb\u5165\u5230\u5185\u5b58\uff0c\u518d\u5728\u5185\u5b58\u4e2d\u8fdb\u884c\u67e5\u627e\uff0c\u6700\u540e\u5f97\u5230\u8981\u5728\u627e\u7684\u6570\u636e\u3002\u56e0\u4e3a\u9875\u76ee\u5f55\u4e2d\u7684\u69fd\u662f\u6309\u7167\u4e3b\u952e\u987a\u5e8f\u6392\u5217\u7684\uff0c\u6240\u4ee5\u5728\u6bcf\u4e00\u4e2a\u9875\u76ee\u5f55\u4e2d\uff0c\u901a\u8fc7\u4e8c\u5206\u67e5\u627e\uff0c\u5b9a\u4f4d\u5230\u6570\u636e\u884c\u6240\u5728\u7684\u9875\uff0c\u7136\u540e\u5c06\u6574\u4e2a\u9875\u8bfb\u5165\u5185\u5b58\uff0c\u8fdb\u800c\u5c06\u6574\u4e2a\u9875\u4e2d\u7684\u5355\u5411\u94fe\u8868\u904d\u5386\u5f97\u5230\u76f8\u5e94\u7684\u884c\u6570\u636e\u3002\u4e0b\u9762\u51e0\u4e2a\u94fe\u63a5\u4e2d\u6587\u7ae0\u4ed4\u4ed4\u7ec6\u7ec6\u7684\u8be6\u8ff0\u4e86\u8fd9\u4e2d\u601d\u7ef4\u3002<\/p>\n<p><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxNTQ3NDMzMw==&amp;mid=2247483670&amp;idx=1&amp;sn=751d84d0ce50d64934d636014abe2023&amp;chksm=979688e4a0e101f2a51d1f06ec75e25c56f8936321ae43badc2fe9fc1257b4dc1c24223699de&amp;scene=21#wechat_redirect\" rel=\"nofollow\" data-token=\"a5f6070d3174d06f3c50771c836668e3\">InnoDB\u8bb0\u5f55\u5b58\u50a8\u7ed3\u6784<\/a><\/p>\n<p><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxNTQ3NDMzMw==&amp;mid=2247483678&amp;idx=1&amp;sn=913780d42e7a81fd3f9b747da4fba8ec&amp;chksm=979688eca0e101fa0913c3d2e6107dfa3a6c151a075c8d68ab3f44c7c364d9510f9e1179d94d&amp;scene=21#wechat_redirect\" rel=\"nofollow\" data-token=\"b4fe71cdeb5ea882d0af986270a00c23\">InnoDB\u6570\u636e\u9875\u7ed3\u6784<\/a><\/p>\n<p><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxNTQ3NDMzMw==&amp;mid=2247483701&amp;idx=1&amp;sn=bd229dd584f51ef4fe545d44ad8cdbf9&amp;chksm=979688c7a0e101d1b5c752094013b78f5bd50ab905257ba82149d85d35ea07aba1a15b0e52b4#rd\" rel=\"nofollow\" data-token=\"188b4acc0122dcdf91f9730acff2fc5a\">MySQL\u7684\u7d22\u5f15\u5b9e\u73b0<\/a><\/p>\n<p>\u603b\u7ed3<br \/>\n1\u3001\u5bf9\u4e8eInnoDB\u5b58\u50a8\u5f15\u64ce\u6765\u8bf4\uff0c\u5728\u5355\u4e2a\u9875\u4e2d\u67e5\u627e\u67d0\u6761\u8bb0\u5f55\u5206\u4e3a\u4e24\u79cd\u60c5\u51b5\uff1a<\/p>\n<ul>\n<li>\u4ee5\u4e3b\u952e\u4e3a\u641c\u7d22\u6761\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528Page Directory\u901a\u8fc7\u4e8c\u5206\u6cd5\u5feb\u901f\u5b9a\u4f4d\u76f8\u5e94\u7684\u7528\u6237\u8bb0\u5f55\u3002<\/li>\n<li>\u4ee5\u5176\u4ed6\u5217\u4e3a\u641c\u7d22\u6761\u4ef6\uff0c\u9700\u8981\u6309\u7167\u8bb0\u5f55\u7ec4\u6210\u7684\u5355\u94fe\u8868\u4f9d\u6b21\u904d\u5386\u5404\u6761\u8bb0\u5f55\u3002<\/li>\n<\/ul>\n<p>2\u3001\u6ca1\u6709\u7d22\u5f15\u7684\u60c5\u51b5\u4e0b\uff0c\u4e0d\u8bba\u662f\u4ee5\u4e3b\u952e\u8fd8\u662f\u5176\u4ed6\u5217\u4f5c\u4e3a\u641c\u7d22\u6761\u4ef6\uff0c\u53ea\u80fd\u6cbf\u7740\u9875\u7684\u53cc\u94fe\u8868\u4ece\u5de6\u5230\u53f3\u4f9d\u6b21\u904d\u5386\u5404\u4e2a\u9875\u3002<\/p>\n<p>3\u3001InnoDB\u5b58\u50a8\u5f15\u64ce\u7684\u7d22\u5f15\u662f\u4e00\u68f5B+\u6811\uff0c\u5b8c\u6574\u7684\u7528\u6237\u8bb0\u5f55\u90fd\u5b58\u50a8\u5728B+\u6811\u7b2c0\u5c42\u7684\u53f6\u5b50\u8282\u70b9\uff0c\u5176\u4ed6\u5c42\u6b21\u7684\u8282\u70b9\u90fd\u5c5e\u4e8e\u5185\u8282\u70b9\uff0c\u5185\u8282\u70b9\u91cc\u5b58\u50a8\u7684\u662f\u76ee\u5f55\u9879\u8bb0\u5f55\u3002InnoDB\u7684\u7d22\u5f15\u5206\u4e3a\u4e24\u5927\u79cd\uff1a<\/p>\n<ul>\n<li>\u805a\u7c07\u7d22\u5f15\uff1a\u4ee5\u4e3b\u952e\u503c\u7684\u5927\u5c0f\u4e3a\u9875\u548c\u8bb0\u5f55\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u5728\u53f6\u5b50\u8282\u70b9\u5904\u5b58\u50a8\u7684\u8bb0\u5f55\u5305\u542b\u4e86\u8868\u4e2d\u6240\u6709\u7684\u5217\u3002<\/li>\n<li>\u4e8c\u7ea7\u7d22\u5f15\u6216\u53eb\u505a\u8f85\u52a9\u7d22\u5f15\uff1a\u4ee5\u81ea\u5b9a\u4e49\u7684\u5217\u7684\u5927\u5c0f\u4e3a\u9875\u548c\u8bb0\u5f55\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u5728\u53f6\u5b50\u8282\u70b9\u5904\u5b58\u50a8\u7684\u8bb0\u5f55\u5185\u5bb9\u662f\u5217\u5185\u5bb9 + \u4e3b\u952e\u3002\u4e8c\u7ea7\u8282\u70b9\u67e5\u627e\u9700\u8981\u67e5\u627e\u4e8c\u7ea7\u8282\u70b9B+\u6811\uff0c\u7136\u540e\u518d\u67e5\u770b\u805a\u96c6\u7d22\u5f15B+\u6811\u4e2d\u53f6\u5b50\u8282\u70b9\u5bf9\u5e94\u7684\u8bb0\u5f55\u5185\u5bb9\u3002<\/li>\n<\/ul>\n<p>4\u3001MyISAM\u5b58\u50a8\u5f15\u64ce\u7684\u6570\u636e\u548c\u7d22\u5f15\u5206\u5f00\u5b58\u50a8\uff0c\u8fd9\u79cd\u5b58\u50a8\u5f15\u64ce\u7684\u7d22\u5f15\u5168\u90e8\u90fd\u662f\u4e8c\u7ea7\u7d22\u5f15\uff0c\u5728\u53f6\u5b50\u8282\u70b9\u5904\u5b58\u50a8\u7684\u662f\u5217 + \u9875\u53f7\u3002<\/p>\n<h1 id=\"innodb\u4f7f\u7528\u7d22\u5f15\"><a name=\"t3\"><\/a>InnoDB\u4f7f\u7528\u7d22\u5f15<\/h1>\n<p>1\u3001\u5728\u521b\u5efa\u8868\u7684\u65f6\u5019\u901a\u8fc7key\u6216index\u6307\u5b9a\u7d22\u5f15\u3002<br \/>\n2\u3001\u901a\u8fc7alter\u4fee\u6539\u8868\u7684\u7ed3\u6784\uff0c\u6dfb\u52a0\u7d22\u5f15\u3002<br \/>\n\u524d\u9762\u94fe\u63a5\u4e2d\u5df2\u7ecf\u8bf4\u660e\u4e86\u5e94\u8be5\u5982\u4f55\u4f7f\u7528\u4e86\u3002<\/p>\n<h1 id=\"innodb\u7d22\u5f15\u5931\u6548\"><a name=\"t4\"><\/a>InnoDB\u7d22\u5f15\u5931\u6548<\/h1>\n<p>1\u3001\u5982\u679c\u6761\u4ef6\u4e2d\u6709or\uff0c\u5373\u4f7f\u5176\u4e2d\u6709\u90e8\u5206\u6761\u4ef6\u5e26\u7d22\u5f15\u4e5f\u4e0d\u4f1a\u4f7f\u7528\uff0c\u9664\u975e\u6761\u4ef6\u4e2d\u7684\u5217\u5168\u90e8\u6709\u7d22\u5f15\u3002<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20180528114956547?watermark\/2\/text\/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTA3MTA0NTg=\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>2\u3001like\u67e5\u8be2\u662f\u4ee5%\u5f00\u5934<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20180528114704507?watermark\/2\/text\/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTA3MTA0NTg=\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>3\u3001\u5982\u679c\u5217\u7c7b\u578b\u662f\u5b57\u7b26\u4e32\uff0c\u90a3\u4e00\u5b9a\u8981\u5728\u6761\u4ef6\u4e2d\u5c06\u6570\u636e\u4f7f\u7528\u5f15\u53f7\u5f15\u7528\u8d77\u6765,\u5426\u5219\u4e0d\u4f7f\u7528\u7d22\u5f15\u3002<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20180528115008634?watermark\/2\/text\/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTA3MTA0NTg=\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>4\u3001\u5982\u679cmysql\u4f30\u8ba1\u4f7f\u7528\u5168\u8868\u626b\u63cf\u8981\u6bd4\u4f7f\u7528\u7d22\u5f15\u5feb,\u5219\u4e0d\u4f7f\u7528\u7d22\u5f15\u3002<br \/>\n\u6b64\u5916\uff0c\u67e5\u770b\u7d22\u5f15\u7684\u4f7f\u7528\u60c5\u51b5<br \/>\nshow status like \u2018Handler_read%\u2019;<br \/>\n\u5927\u5bb6\u53ef\u4ee5\u6ce8\u610f\uff1a<br \/>\nhandler_read_key:\u8fd9\u4e2a\u503c\u8d8a\u9ad8\u8d8a\u597d\uff0c\u8d8a\u9ad8\u8868\u793a\u4f7f\u7528\u7d22\u5f15\u67e5\u8be2\u5230\u7684\u6b21\u6570<br \/>\nhandler_read_rnd_next:\u8fd9\u4e2a\u503c\u8d8a\u9ad8\uff0c\u8bf4\u660e\u67e5\u8be2\u4f4e\u6548<\/p>\n<h1 id=\"innodb\u5168\u6587\u641c\u7d22\"><a name=\"t5\"><\/a>InnoDB\u5168\u6587\u641c\u7d22<\/h1>\n<p>B+\u6811\u7d22\u5f15\u7684\u7279\u70b9\u662f\u652f\u6301\u524d\u7f00\u8fdb\u884c\u67e5\u627e\uff0c\u4f8b\u5982<code>SELECT * FROM blog WHERE content like 'xxx%'<\/code>\u3002\u5bf9\u4e8e<code>SELECT * FROM blog WHERE content like '%xxx'<\/code>\uff0c\u5e76\u4e0d\u652f\u6301\uff0c\u8fd9\u79cd\u6a21\u5f0f\u4f1a\u5bfc\u81f4InnoDB\u626b\u63cf\u6574\u4e2a\u8868\uff0c\u901f\u5ea6\u4f1a\u975e\u5e38\u6162\u3002\u90a3\u4e48\u73b0\u5728\u5c31\u9700\u8981\u4e00\u79cd\u65b9\u6848\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002\u90a3\u5c31\u662f\u5168\u6587\u7d22\u5f15\u3002InnoDB 1.2\u7248\u672c\u5f00\u59cb\uff0c\u5df2\u7ecf\u5168\u9762\u652f\u6301\u4e86\u5168\u6587\u7d22\u5f15(Full-Text Search )\u3002<strong>\u5168\u6587\u68c0\u7d22\u662f\u5c06\u5b58\u50a8\u4e8e\u6570\u636e\u5e93\u4e2d\u7684\u6574\u672c\u4e66\u6216\u6574\u7bc7\u6587\u7ae0\u4e2d\u7684\u4efb\u610f\u5185\u5bb9\u5355\u8bcd\u67e5\u627e\u51fa\u6765\u7684\u6280\u672f\u3002<\/strong>\u5b83\u53ef\u4ee5\u6839\u636e\u9700\u8981\u83b7\u5f97\u5168\u6587\u4e2d\u6709\u5173\u7ae0\u3001\u8282\u3001\u6bb5\u3001\u53e5\u3001\u8bcd\u7b49\u4fe1\u606f\uff0c\u4e5f\u53ef\u4ee5\u8fdb\u884c\u5404\u79cd\u7edf\u8ba1\u548c\u5206\u6790\u3002<strong>\u5168\u6587\u7d22\u5f15\u4f7f\u7528\u5012\u6392\u7d22\u5f15\u5b9e\u73b0\uff0c\u8f85\u52a9\u8868\u4e2d\u5b58\u50a8\u4e86\u5355\u8bcd\u4e0e\u5355\u8bcd\u81ea\u8eab\u5728\u4e00\u4e2a\u6216\u591a\u4e2a\u6587\u6863\u4e2d\u7684\u6620\u5c04\u3002<\/strong>\u5c06\u6574\u4e2a\u8868\u4e2d\u5355\u8bcd\u6240\u5728\u7684\u884c\u53ca\u5176\u4f4d\u7f6e\u5168\u90e8\u7d22\u5f15\u51fa\u6765\u3002\u8fd9\u6837\u5728\u9700\u8981\u4ece\u4e2d\u68c0\u7d22\u51fa\u884c\u4e2d\u91ca\u653e\u542b\u6709\u67d0\u4e2a\u5355\u8bcd\u5c31\u5f88\u5feb\u4e86\u3002<br \/>\n\u8868\u73b0\u5f62\u5f0f\u5c31\u662f\uff5b\u5355\u8bcd\uff0c\uff08\u5355\u8bcd\u6240\u5728\u6587\u6863ID \uff0c \u5728\u5177\u4f53\u6587\u6863\u4e2d\u7684\u4f4d\u7f6e\uff09\uff5d\u3002<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20180528163346328?watermark\/2\/text\/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTA3MTA0NTg=\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>1\u3001\u4f7f\u7528\u5168\u6587\u7d22\u5f15<br \/>\n\u4e3a\u4e86\u8fdb\u884c\u5168\u6587\u672c\u641c\u7d22\uff0c\u5fc5\u987b\u7d22\u5f15\u88ab\u641c\u7d22\u7684\u5217\uff0c\u800c\u4e14\u8981\u968f\u7740\u6570\u636e\u7684\u6539\u53d8\u4e0d\u65ad\u5730\u91cd\u65b0\u7d22\u5f15\u3002\u5728\u5bf9\u8868\u5217\u8fdb\u884c\u9002\u5f53\u8bbe\u8ba1\u540e\uff0c MySQL\u4f1a\u81ea\u52a8\u8fdb\u884c\u6240\u6709<br \/>\n\u7684\u7d22\u5f15\u548c\u91cd\u65b0\u7d22\u5f15\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"language-c hljs  has-numbering\">CREATE TABLE productnotes\r\n(\r\n  note_id    <span class=\"hljs-keyword\">int<\/span>           NOT NULL AUTO_INCREMENT,\r\n  prod_id    <span class=\"hljs-keyword\">char<\/span>(<span class=\"hljs-number\">10<\/span>)      NOT NULL,\r\n  note_date datetime       NOT NULL,\r\n  note_text  text          NULL ,\r\n  PRIMARY KEY(note_id),\r\n  FULLTEXT(note_text)\r\n) ENGINE=InnoDB;\r\n<span class=\"hljs-comment\">\/\/\u4f7f\u7528InnoDB\u5f15\u64ce\uff0c\u5e76\u4e14\u901a\u8fc7FULLTEXT(note_text)\u6307\u793a\u5bf9\u5176\u8fdb\u884c\u7d22\u5f15\uff0c\u7d22\u5f15\u662f\u5355\u4e2a\u5217\uff0c<\/span>\r\n<span class=\"hljs-comment\">\/\/\u5b9a\u4e49\u4e4b\u540eMySQL\u81ea\u52a8\u7ef4\u62a4\u8be5\u7d22\u5f15\uff0c\u5728\u589e\u52a0\u3001\u5220\u9664\u3001\u66f4\u65b0\u884c\u65f6\u5019\uff0c\u7d22\u5f15\u81ea\u52a8\u66f4\u65b0\u3002<\/span>\r\n\r\nmysql&gt; explain select note_text from productnotes where match(note_text) against(<span class=\"hljs-string\">'rabbit'<\/span>)\\G;\r\n*************************** <span class=\"hljs-number\">1.<\/span> row ***************************\r\n           id: <span class=\"hljs-number\">1<\/span>\r\n  select_type: SIMPLE\r\n        table: fulltxt\r\n   partitions: NULL\r\n         type: fulltext\r\npossible_keys: note_text\r\n          key: note_text\r\n      key_len: <span class=\"hljs-number\">0<\/span>\r\n          ref: <span class=\"hljs-keyword\">const<\/span>\r\n         rows: <span class=\"hljs-number\">1<\/span>\r\n     filtered: <span class=\"hljs-number\">100.00<\/span>\r\n        Extra: Using where; Ft_hints: sorted\r\n<span class=\"hljs-number\">1<\/span> row in <span class=\"hljs-built_in\">set<\/span>, <span class=\"hljs-number\">1<\/span> warning (<span class=\"hljs-number\">0.01<\/span> sec)\r\n<span class=\"hljs-comment\">\/\/\u63d0\u793a\u4f7f\u7528\u4e86\u5168\u6587\u7d22\u5f15\uff0c\u52a0\u5feb\u7d22\u5f15\u8d77\u6765\u3002<\/span>\r\n\r\nselect note_id , note_text from fulltxt where match(note_text) against(<span class=\"hljs-string\">'rabbit'<\/span>)\\G;\r\n*************************** <span class=\"hljs-number\">1.<\/span> row ***************************\r\n  note_id: <span class=\"hljs-number\">104<\/span>\r\nnote_text: Quantity varies, sold by the sack load.\r\nAll guaranteed to be bright and orange, and suitable <span class=\"hljs-keyword\">for<\/span> use as rabbit bait.\r\n*************************** <span class=\"hljs-number\">2.<\/span> row ***************************\r\n  note_id: <span class=\"hljs-number\">110<\/span>\r\nnote_text: Customer complaint: rabbit has been able to detect trap, food apparently less effective now.\r\n<span class=\"hljs-number\">2<\/span> rows in <span class=\"hljs-built_in\">set<\/span> (<span class=\"hljs-number\">0.00<\/span> sec)\r\n<span class=\"hljs-comment\">\/\/\u5728\u7d22\u5f15\u4e4b\u540e\uff0c\u4f7f\u7528\u4e24\u4e2a\u51fd\u6570Match()\u548cAgainst()\u6267\u884c\u5168\u6587\u672c\u641c\u7d22<\/span>\r\n<span class=\"hljs-comment\">\/\/match\u6307\u5b9a\u641c\u7d22\u7684\u5217\uff0cagainst\u6307\u5b9a\u4f7f\u7528\u641c\u7d22\u7684\u8868\u8fbe\u5f0f\u3002<\/span>\r\n<span class=\"hljs-comment\">\/\/\u4f20\u9012\u7ed9match\u7684\u503c\uff0c\u5fc5\u987b\u548cFULLTEXT\u4e2d\u5b9a\u4e49\u7684\u76f8\u540c\uff0c\u5305\u62ec\u6b21\u5e8f\uff0c\u5e76\u4e14\u5168\u6587\u641c\u7d22\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u3002<\/span>\r\n\r\nselect note_id , note_text from fulltxt where note_text like <span class=\"hljs-string\">'%rabbit%'<\/span>\\G;\r\n*************************** <span class=\"hljs-number\">1.<\/span> row ***************************\r\n  note_id: <span class=\"hljs-number\">104<\/span>\r\nnote_text: Quantity varies, sold by the sack load.\r\nAll guaranteed to be bright and orange, and suitable <span class=\"hljs-keyword\">for<\/span> use as rabbit bait.\r\n*************************** <span class=\"hljs-number\">2.<\/span> row ***************************\r\n  note_id: <span class=\"hljs-number\">110<\/span>\r\nnote_text: Customer complaint: rabbit has been able to detect trap, food apparently less effective now.\r\n<span class=\"hljs-number\">2<\/span> rows in <span class=\"hljs-built_in\">set<\/span> (<span class=\"hljs-number\">0.00<\/span> sec)\r\n<span class=\"hljs-comment\">\/\/\u7b49\u6548\u4e8elike,\u8fd4\u56de\u6b21\u5e8f\u4e0d\u540c\u3002\u800c\u5168\u6587\u641c\u7d22\u8fd4\u56de\u7684\u6587\u672c\u6392\u5e8f\u4e86\u3002<\/span><\/code><\/pre>\n<p>2\u3001\u6f14\u793a\u5168\u6587\u7d22\u5f15\u7684\u4f18\u5148\u7ea7<br \/>\n\u7b49\u7ea7\u7531MySQL\u6839\u636e\u884c\u4e2d\u8bcd\u7684\u6570\u76ee\u3001\u552f\u4e00\u8bcd\u7684\u6570\u76ee\u3001\u6574\u4e2a\u7d22\u5f15\u4e2d\u8bcd\u7684\u603b\u6570\u4ee5\u53ca\u5305\u542b\u8be5\u8bcd\u7684\u884c\u7684\u6570\u76ee\u8ba1\u7b97\u51fa\u6765\u3002<br \/>\n\u4e0d\u5305\u542b\u8bcdrabbit\u7684\u884c\u7b49\u7ea7\u4e3a0\uff08\u56e0\u6b64\u4e0d\u88ab\u524d\u4e00\u4f8b\u5b50\u4e2d\u7684WHERE\u5b50\u53e5\u9009\u62e9\uff09\u3002\u786e\u5b9e\u5305\u542b\u8bcdrabbit<br \/>\n\u7684\u4e24\u4e2a\u884c\u6bcf\u884c\u90fd\u6709\u4e00\u4e2a\u7b49\u7ea7\u503c\uff0c\u6587\u672c\u4e2d\u8bcd\u9760\u524d\u7684\u884c\u7684\u7b49\u7ea7\u503c\u6bd4\u8bcd\u9760\u540e\u7684\u884c\u7684\u7b49\u7ea7\u503c\u9ad8\u3002<br \/>\n\u5168\u6587\u672c\u641c\u7d22\u6392\u9664\u90a3\u4e9b\u7b49\u7ea7\u4e3a0\u7684\u884c\uff0c\u7136\u540e\u6309\u7b49\u7ea7\u4ee5\u964d\u5e8f\u6392\u5e8f\u3002<\/p>\n<p>3\u3001\u4f7f\u7528\u67e5\u8be2\u6269\u5c55<br \/>\n\u67e5\u8be2\u6269\u5c55\u7528\u6765\u8bbe\u6cd5\u653e\u5bbd\u6240\u8fd4\u56de\u7684\u5168\u6587\u672c\u641c\u7d22\u7ed3\u679c\u7684\u8303\u56f4\u3002<br \/>\n\u4f8b\u5982\uff1a\u4f60\u60f3\u627e\u51fa\u6240\u6709\u63d0\u5230anvils\u7684\u6ce8\u91ca\u3002\u53ea\u6709\u4e00\u4e2a\u6ce8\u91ca\u5305\u542b\u8bcdanvils\uff0c\u4f46\u4f60\u8fd8\u60f3\u627e\u51fa\u53ef\u80fd\u4e0e\u4f60\u7684\u641c\u7d22\u6709\u5173\u7684\u6240\u6709\u5176\u4ed6\u884c\uff0c\u5373\u4f7f\u4ed6\u4eec\u4e0d\u5305\u542banvils\u3002<br \/>\n\u65b9\u6cd5\uff1a\u4f7f\u7528\u67e5\u8be2\u6269\u5c55\u65f6\uff0cMySQL\u5bf9\u6570\u636e\u548c\u7d22\u5f15\u8fdb\u884c\u4e24\u904d\u626b\u63cf\u6765\u5b8c\u6210\u641c\u7d22\u3002<br \/>\n\u9996\u5148\uff0c\u8fdb\u884c\u4e00\u4e2a\u57fa\u672c\u7684\u5168\u6587\u672c\u641c\u7d22\uff0c\u627e\u51fa\u4e0e\u641c\u7d22\u6761\u4ef6\u5339\u914d\u7684\u6240\u6709\u884c\u3002<br \/>\n\u5176\u6b21\uff0c MySQL\u68c0\u67e5\u8fd9\u4e9b\u5339\u914d\u884c\u5e76\u9009\u62e9\u6240\u6709\u6709\u7528\u7684\u8bcd\u3002<br \/>\n\u518d\u5176\u6b21\uff0c MySQL\u518d\u6b21\u8fdb\u884c\u5168\u6587\u672c\u641c\u7d22\uff0c\u8fd9\u6b21\u4e0d\u4ec5\u4f7f\u7528\u539f\u6765\u7684\u6761\u4ef6\uff0c\u800c\u4e14\u8fd8\u4f7f\u7528\u6240\u6709\u6709\u7528\u7684\u8bcd\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs sql has-numbering\"><span class=\"hljs-operator\"><span class=\"hljs-keyword\">select<\/span> note_text <span class=\"hljs-keyword\">from<\/span> productnotes\r\n<span class=\"hljs-keyword\">where<\/span> <span class=\"hljs-keyword\">match<\/span>(note_text) against(<span class=\"hljs-string\">'anvils'<\/span>);<\/span>\r\n\/\/\u4e0d\u4f7f\u7528\u67e5\u8be2\u6269\u5c55\r\n\r\n<span class=\"hljs-operator\"><span class=\"hljs-keyword\">select<\/span> note_text <span class=\"hljs-keyword\">from<\/span> productnotes\r\n<span class=\"hljs-keyword\">where<\/span> <span class=\"hljs-keyword\">match<\/span>(note_text) against(<span class=\"hljs-string\">'anvils'<\/span> <span class=\"hljs-keyword\">with<\/span> query expansion);<\/span>\r\n\/\/\u4f7f\u7528\u67e5\u8be2\u6269\u5c55<\/code><\/pre>\n<h1 id=\"\u53c2\u8003\"><a name=\"t6\"><\/a>\u53c2\u8003<\/h1>\n<p><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxNTQ3NDMzMw==&amp;mid=2247483670&amp;idx=1&amp;sn=751d84d0ce50d64934d636014abe2023&amp;chksm=979688e4a0e101f2a51d1f06ec75e25c56f8936321ae43badc2fe9fc1257b4dc1c24223699de&amp;scene=21#wechat_redirect\" rel=\"nofollow\" data-token=\"a5f6070d3174d06f3c50771c836668e3\">\u53c2\u80031-\u5c0f\u9752\u86d9<\/a><br \/>\n<a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxNTQ3NDMzMw==&amp;mid=2247483701&amp;idx=1&amp;sn=bd229dd584f51ef4fe545d44ad8cdbf9&amp;chksm=979688c7a0e101d1b5c752094013b78f5bd50ab905257ba82149d85d35ea07aba1a15b0e52b4#rd\" rel=\"nofollow\" data-token=\"188b4acc0122dcdf91f9730acff2fc5a\">\u53c2\u770b2-\u5c0f\u9752\u86d9<\/a><br \/>\n\u53c2\u80033-InnoDB\u6280\u672f\u5185\u5e55\u8be6\u89e3<\/p>\n<\/div>\n<\/div>\n<\/article>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u5730\u5740 \u00a0\u7248\u6743\u58f0\u660e\uff1a\u672c\u6587\u4e3a\u535a\u4e3b\u539f\u521b\u6587\u7ae0<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[],"tags":[119],"class_list":["post-3719","post","type-post","status-publish","format-standard","hentry","tag-03-"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/3719","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=3719"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/3719\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=3719"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=3719"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=3719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}