{"id":10008048,"date":"2023-07-06T15:02:24","date_gmt":"2023-07-06T07:02:24","guid":{"rendered":"https:\/\/ityet.com\/?p=10008048"},"modified":"2023-07-06T15:02:24","modified_gmt":"2023-07-06T07:02:24","slug":"mybatis-sql%e5%88%86%e6%9e%90%e7%bb%84%e4%bb%b6-%e4%ba%ac%e4%b8%9c%e4%ba%91%e6%8a%80%e6%9c%af%e5%9b%a2%e9%98%9f","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10008048","title":{"rendered":"Mybatis-SQL\u5206\u6790\u7ec4\u4ef6 | \u4eac\u4e1c\u4e91\u6280\u672f\u56e2\u961f"},"content":{"rendered":"<h2>\u80cc\u666f<\/h2>\n<p>\u5927\u4fc3\u5907\u6218\uff0c\u6700\u5927\u7684\u9690\u60a3\u9879\u4e4b\u4e00\u5c31\u662f\u6162sql\uff0c\u5e26\u6765\u7684\u7834\u574f\u6027\u6700\u5927\uff0c\u4e5f\u662f\u65e5\u5e38\u5de5\u4f5c\u4e2d\u7ecf\u5e38\u5e26\u6765\u6574\u4e2a\u5e94\u7528\u6296\u52a8\u7684\u6700\u5927\u9690\u60a3\uff0c\u800c\u4e14\u5bf9sql\u597d\u574f\u7684\u8bc4\u4f30\u6709\u4e00\u5b9a\u7684\u6280\u672f\u8981\u6c42\uff0c\u6709\u4e00\u4e9b\u7f3a\u4e4f\u7ecf\u9a8c\u6216\u8005\u56e0\u4e3a\u4e0d\u591f\u4ed4\u7ec6\u9020\u6210\u4e00\u4e2a\u574f\u7684sql\u6210\u529f\u8d70\u5230\u4e86\u7ebf\u4e0a\uff0c\u7b49\u53d1\u73b0\u7684\u65f6\u5019\u8981\u4e48\u662f\u9020\u6210\u4e86\u7ebf\u4e0a\u5f71\u54cd\u3001\u62a5\u8b66\u3001\u6216\u8005\u540e\u7f6e\u7684\u6162sql\u91c7\u96c6\u53d1\u73b0\uff0c\u8fd9\u65f6\u5019\u4e00\u822c\u65e0\u6cd5\u5feb\u901f\u6b62\u635f\uff0c\u9700\u8981\u4fee\u6539\u4ee3\u7801\u4e0a\u7ebf\u3001\u6216\u8005\u8c03\u6574\u6570\u636e\u5e93\u7d22\u5f15\u3002<\/p>\n<p>\u6838\u5fc3\u75db\u70b9\uff1a<\/p>\n<p><strong>1\u3001\u65e0\u6cd5\u63d0\u524d\u53d1\u73b0\u6162sql\uff0c\u53ef\u80fd\u6076\u5316\u4e3a\u6162sql\u7684\u8bed\u53e5<\/strong><\/p>\n<p><strong>2\u3001\u7ebf\u4e0a\u51fa\u73b0\u6162sql\u540e\uff0c\u65e0\u6cd5\u5feb\u901f\u6b62\u635f<\/strong><\/p>\n<h2>\u89e3\u51b3\u601d\u8def<\/h2>\n<p><strong>1\u3001\u628a\u95ee\u9898\u89e3\u51b3\u5728\u4e0a\u7ebf\u4e4b\u524d\uff0c\u6700\u597d\u7684\u529e\u6cd5\u5c31\u662f\u5728\u6d4b\u8bd5\u9636\u6bb5\uff0c\u751a\u81f3\u5728\u5f00\u53d1\u9636\u6bb5\u5c31\u53d1\u73b0\u4e00\u4e2asql\u7684\u597d\u574f<\/strong><\/p>\n<p><strong>2\u3001\u7ebf\u4e0a\u53d1\u73b0\u6162sql\u540e\u9664\u4e86\u6539\u4ee3\u7801\u4e0a\u7ebf\u3001\u8c03\u6574\u6570\u636e\u5e93\u8868\u7d22\u5f15\u7684\u65b9\u5f0f\u5916\uff0c\u652f\u6301\u70ed\u66f4\u65b0\u7684\u65b9\u5f0f\u66ff\u6362sql\u8bed\u53e5<\/strong>\u3002<\/p>\n<p>\u90e8\u95e8\u5185\u90e8\uff0c\u76ee\u524d\u5927\u90e8\u5206\u6570\u636e\u5e93\u6846\u67b6\u91c7\u7528\u7684mybatis\uff0c\u7136\u540e\u57fa\u4e8emybatis\u672c\u8eab\u7684\u5b9e\u73b0\u673a\u5236\u4e2d\uff0c\u5f00\u53d1\u4e00\u4e2amybatis\u7ec4\u4ef6\uff0c\u53ef\u4ee5\u81ea\u52a8\u5bf9\u8fd0\u884c\u7684sql\u8fdb\u884c\u63d0\u53d6\u548c\u5206\u6790\uff0c\u5b9a\u5236\u4e00\u5957\u9ed8\u8ba4\u7684\u5206\u6790\u89c4\u5219\uff0c\u8ba9sql\u5728\u5f00\u53d1\u73af\u5883\u548c\u6d4b\u8bd5\u73af\u5883\u6267\u884c\u7684\u65f6\u5019\uff0c\u5c31\u80fd\u591f\u505a\u521d\u6b65\u7684\u8bc4\u4f30\uff0c\u628a\u6709\u95ee\u9898\u7684\u6162sql\u5728\u8fd9\u4e2a\u9636\u6bb5\u66b4\u9732\u51fa\u6765\uff1b\u540c\u65f6\u5177\u5907sql\u66ff\u6362\u529f\u80fd\uff0c\u5728\u7ebf\u4e0a\u51fa\u73b0\u95ee\u9898sql\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u901a\u8fc7ducc\u914d\u7f6e\u5feb\u901f\u5b8c\u6210\u5bf9\u4e00\u4e2asql\u7684\u5728\u7ebf\u66ff\u6362\uff0c\u5927\u5927\u964d\u4f4e\u7ebf\u4e0a\u95ee\u9898\u7684\u6b62\u635f\u65f6\u95f4\u3002<\/p>\n<h2>\u5f00\u6e90\u65b9\u6848\u8c03\u7814<\/h2>\n<p>\u76ee\u524d\uff0c\u4e3b\u6d41\u7684sql\u5206\u6790\u7ec4\u4ef6\uff0c\u6838\u5fc3\u529f\u80fd\u4e3b\u8981\u653e\u5728\u4e86\u4e24\u4e2a\u65b9\u5411\uff1a1\u3001\u6162sql\u7684\u5206\u6790\u548c\u4f18\u5316\u5efa\u8bae 2\u3001sql\u7684\u4f18\u5316\u91cd\u5199\u529f\u80fd\uff0c\u800c\u4e14\u4e3b\u8981\u504f\u8fd0\u7ef4\u7684\u8f85\u52a9\u529f\u80fd\u65e0\u6cd5\u505a\u5230\u65e0\u4fb5\u5165\u7684\u548c\u5e94\u7528\u4ee3\u7801\u8fdb\u884c\u96c6\u6210\u3002\u4e5f\u5c31\u65e0\u6cd5\u5b9e\u73b0\u6211\u4eec\u7684\u6838\u5fc3\u75db\u70b9\uff0c\u6162sql\u63d0\u524d\u5206\u6790\u9884\u8b66\u548c\u52a8\u6001sql\u66ff\u6362\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043977190\" alt=\"\" title=\"\" loading=\"lazy\">[]()<\/p>\n<h2>\u8bbe\u8ba1\u65b9\u6848<\/h2>\n<p><strong>\u6838\u5fc3\u529f\u80fd\uff1aSQL\u5206\u6790\u9884\u8b66\u80fd\u529b\u3001SQL\u66ff\u6362\u80fd\u529b<\/strong><\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043977191\" alt=\"\" title=\"\" loading=\"lazy\">[]()<\/p>\n<h2>\u8be6\u7ec6\u8bbe\u8ba1<\/h2>\n<p>\u4e3b\u8981\u5206\u4e3a8\u4e2a\u529f\u80fd\u6a21\u5757<\/p>\n<p>\u6a21\u5757\u4e00\uff1acore \u4e3b\u8981\u8d1f\u8d23\u7ec4\u4ef6\u7684\u63a5\u5165\u5230mybatis\uff0c\u4ee5\u53ca\u5176\u5b83\u6a21\u5757\u7684\u7f16\u6392\u8c03\u7528<\/p>\n<p>\u6a21\u5757\u4e8c\uff1aconfig \u4e3b\u8981\u8d1f\u8d23\u7ec4\u4ef6\u914d\u7f6e\u4fe1\u606f\u7684\u521d\u59cb\u5316<\/p>\n<p>\u6a21\u5757\u4e09\uff1aextrat \u4e3b\u8981\u901a\u8fc7\u89e3\u6790mybatis \u76f8\u5173\u5bf9\u8c61\uff0c\u63d0\u53d6\u5b8c\u6574\u7684\u5f85\u6267\u884csql<\/p>\n<p>\u6a21\u5757\u56db\uff1aanalysis \u4e3b\u8981\u62fc\u63a5\u5206\u6790\u8bed\u53e5\uff0c\u6267\u884cexplain\u5206\u6790\u8bed\u53e5\u5e76\u83b7\u53d6\u5206\u6790\u7ed3\u679c<\/p>\n<p>\u6a21\u5757\u4e94\uff1arule sql\u5206\u6790\u89c4\u5219\u7684\u52a0\u8f7d\u548c\u521d\u59cb\u5316\uff0c\u652f\u6301\u81ea\u5b9a\u4e49\u89c4\u5219<\/p>\n<p>\u76ee\u524d\u9ed8\u8ba4\u89c4\u5219\uff08\u6301\u7eed\u6269\u5c55\uff09\uff1a<\/p>\n<p>1\u3001\u67e5\u8be2\u672a\u5339\u914d\u7d22\u5f15<\/p>\n<p>2\u3001\u5339\u914d\u7d22\u5f15\u8fc7\u6ee4\u6548\u679c\u8f83\u5dee<\/p>\n<p>3\u3001\u8fd4\u56de\u884c\u6570\u8fc7\u591a<\/p>\n<p>4\u3001\u4f7f\u7528\u4e86\u6587\u4ef6\u6392\u5e8f<\/p>\n<p>\u6a21\u5757\u516d\uff1ascore \u57fa\u4e8e\u5206\u6790\u7ed3\u679c\u548c\u914d\u7f6e\u7684\u8bc4\u5206\u89c4\u5219\u8fdb\u884c\u5339\u914d\u6253\u5206\uff0c\u4f18\u5316\u5efa\u8bae\u7ec4\u88c5<\/p>\n<p>\u6a21\u5757\u4e03\uff1aout \u8f93\u51fa\u6a21\u5757\uff0c\u5bf9\u4e8e\u8f93\u51fa\u7ed3\u679c\u8fdb\u884c\u8f93\u51fa\uff0c\u76ee\u524d\u5df2error\u65e5\u5fd7\u3001MQ\u4e24\u79cd\u8f93\u51fa\u65b9\u5f0f<\/p>\n<p>\u6a21\u5757\u516b\uff1areplace\u66ff\u6362\u6a21\u5757\uff0c\u53ef\u4ee5\u5bf9sql\u8bed\u53e5\u57fa\u4e8educc\u914d\u7f6e\u8fdb\u884c\u52a8\u6001\u66ff\u6362<\/p>\n<h2>\u4f7f\u7528\u65b9\u6cd5<\/h2>\n<h3>1\u3001\u5f15\u5165\u4f9d\u8d56jar\u5305<\/h3>\n<pre><code>&lt;dependency&gt;\n    &lt;groupId&gt;com.jd.sql.analysis&lt;\/groupId&gt;\n    &lt;artifactId&gt;sql-analysis&lt;\/artifactId&gt;\n    &lt;version&gt;1.2-SNAPSHOT&lt;\/version&gt;\n&lt;\/dependency&gt;<\/code><\/pre>\n<h3>2\u3001\u914d\u7f6e\u7ec4\u4ef6xml<\/h3>\n<pre><code>&lt;configuration&gt;\n    &lt;plugins&gt;\n        &lt;plugin interceptor=&quot;com.jd.sql.analysis.core.SqlAnalysisAspect&quot; &gt;\n            &lt;!-- \u5f00\u542fsql\u5206\u6790\u529f\u80fd\u6700\u7b80\u914d\u7f6e --&gt;\n            &lt;property name=&quot;analysisSwitch&quot; value=&quot;true&quot;\/&gt;\n\n            &lt;!-- \u5f00\u542fsql\u66ff\u6362\u529f\u80fd\u6700\u7b80\u914d\u7f6e --&gt;\n            &lt;property name=&quot;sqlReplaceModelSwitch&quot; value=&quot;true&quot;\/&gt;\n            &lt;property name=&quot;duccAppName&quot; value=&quot;workbench-backend&quot;\/&gt;\n            &lt;property name=&quot;duccUri&quot; value=&quot;ucc:\/\/workbench-backend:2d6991cb865f4e6bac6c3e1cf7794cdf@test.ducc.jd.local\/v1\/namespace\/workbench_backend\/config\/default\/profiles\/test?longPolling=60000&amp;necessary=false&quot;\/&gt;\n            &lt;property name=&quot;duccMonitorKey&quot; value=&quot;refundBugFlag&quot;\/&gt;\n        &lt;\/plugin&gt;\n    &lt;\/plugins&gt;\n&lt;\/configuration&gt;<\/code><\/pre>\n<h3>3\u3001\u6838\u5fc3\u914d\u7f6e\u9879<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027<\/th>\n<th>\u7528\u9014<\/th>\n<th>\u662f\u5426\u5fc5\u586b<\/th>\n<th>\u9ed8\u8ba4\u503c<\/th>\n<th>\u5907\u6ce8<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>analysisSwitch<\/td>\n<td>\u662f\u5426\u5f00\u542f\u5206\u6790\u529f\u80fd<\/td>\n<td>\u662f<\/td>\n<td>false<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>onlyCheckOnce<\/td>\n<td>\u662f\u5426\u5bf9\u4e00\u4e2asqlid\u53ea\u5206\u6790\u4e00\u6b21<\/td>\n<td>\u975e<\/td>\n<td>true<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>checkInterval<\/td>\n<td>\u6bcf\u4e2asqlid\u5206\u6790\u95f4\u9694<\/td>\n<td>\u975e<\/td>\n<td>300000\u6beb\u79d2<\/td>\n<td>onlyCheckOnce \u4e3afalse\u624d\u751f\u6548<\/td>\n<\/tr>\n<tr>\n<td>exceptSqlIds<\/td>\n<td>\u9700\u8981\u8fc7\u6ee4\u4e0d\u5206\u6790\u7684sqlid<\/td>\n<td>\u975e<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>sqlType<\/td>\n<td>\u5206\u6790\u7684sql\u7c7b\u578b<\/td>\n<td>\u975e<\/td>\n<td>\u9ed8\u8ba4select\u3001update<\/td>\n<td>\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td>scoreRuleLoadClass<\/td>\n<td>\u8bc4\u5206\u89c4\u5219\u52a0\u8f7d\u5668\uff0c\u7528\u4e8e\u6269\u5c55\u81ea\u5b9a\u4e49\u89c4\u5219<\/td>\n<td>\u975e<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>outModel<\/td>\n<td>\u9ed8\u8ba4\u8f93\u51fa\u65b9\u5f0f<\/td>\n<td>\u975e<\/td>\n<td>\u9ed8\u8ba4\u503c\uff1aLOG<\/td>\n<td>\u652f\u6301LOG\u3001MQ\u4e24\u79cd\u65b9\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>outputClass<\/td>\n<td>\u8bc4\u5206\u7ed3\u679c\u8f93\u51fa\u7c7b\uff0c\u7528\u4e8e\u6269\u5c55\u81ea\u5b9a\u4e49\u7ed3\u679c\u8f93\u51fa\u65b9\u5f0f<\/td>\n<td>\u975e<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>sqlReplaceModelSwitch<\/td>\n<td>sql\u66ff\u6362\u6a21\u5757\u662f\u5426\u5f00\u542f<\/td>\n<td>\u975e<\/td>\n<td>\u9ed8\u8ba4 false<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>duccAppName<\/td>\n<td>ducc\u914d\u7f6e\u7684\u5e94\u7528\u540d\u79f0\uff08jdos\uff09<\/td>\n<td>\u975e<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>duccUri<\/td>\n<td>ducc uri\u914d\u7f6e<\/td>\n<td>\u975e<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>duccMonitorKey<\/td>\n<td>sql\u66ff\u6362\u914d\u7f6e\u6587\u4ef6\u5bf9\u5e94\u7684key<\/td>\n<td>\u975e<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>4\u3001\u9ed8\u8ba4\u5206\u6790\u6548\u679c\u5c55\u793a<\/h3>\n<h4>4.1\u3001\u6162sql\u5206\u6790\u6548\u679c<\/h4>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043977192\" alt=\"\" title=\"\" loading=\"lazy\">[]()<\/p>\n<h4>4.2\u3001sql\u52a8\u6001\u66ff\u6362\u6548\u679c<\/h4>\n<h3>5\u3001\u5b9e\u8df5\u4f7f\u7528\u65b9\u6848<\/h3>\n<h4>5.1\u3001\u6162sql\u5206\u6790-\u65e5\u5fd7\u8f93\u51fa+\u5173\u952e\u8bcd\u544a\u8b66<\/h4>\n<pre><code>&lt;configuration&gt;\n    &lt;plugins&gt;\n        &lt;plugin interceptor=&quot;com.jd.sql.analysis.core.SqlAnalysisAspect&quot; &gt;\n            &lt;property name=&quot;analysisSwitch&quot; value=&quot;true&quot;\/&gt;\n        &lt;\/plugin&gt;\n    &lt;\/plugins&gt;\n&lt;\/configuration&gt;<\/code><\/pre>\n<h4>5.2\u3001\u6162sql\u5206\u6790-\u65e5\u5fd7\u8f93\u51fa+mq\u8f93\u51fa+es\u5b58\u50a8+Kibana\u5206\u6790<\/h4>\n<pre><code>&lt;configuration&gt;\n    &lt;plugins&gt;\n        &lt;plugin interceptor=&quot;com.jd.sql.analysis.core.SqlAnalysisAspect&quot; &gt;\n            &lt;property name=&quot;appName&quot; value=&quot;workbench-backend&quot;\/&gt;\n            &lt;property name=&quot;analysisSwitch&quot; value=&quot;true&quot;\/&gt;\n            &lt;property name=&quot;outputModel&quot; value=&quot;mq&quot;\/&gt;\n            &lt;property name=&quot;mqApp&quot; value=&quot;qlstation&quot;\/&gt;\n            &lt;property name=&quot;mqUser&quot; value=&quot;qlstation&quot;\/&gt;\n            &lt;property name=&quot;mqPassword&quot; value=&quot;D1BCC547&quot;\/&gt;\n            &lt;property name=&quot;mqAddress&quot; value=&quot;jmq-testcluster.jd.local:50088&quot;\/&gt;\n            &lt;property name=&quot;mqTopic&quot; value=&quot;jdl_kds_key_node_log&quot;\/&gt;\n        &lt;\/plugin&gt;\n    &lt;\/plugins&gt;\n&lt;\/configuration&gt;<\/code><\/pre>\n<p>\u6700\u7ec8\u6548\u679c<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043977193\" alt=\"\" title=\"\" loading=\"lazy\">[]()<\/p>\n<h4>5.3\u3001\u6162sql\u66ff\u6362-ducc\u914d\u7f6e\u52a8\u6001\u66f4\u65b0sql\u8bed\u53e5<\/h4>\n<pre><code>&lt;configuration&gt;\n    &lt;plugins&gt;\n        &lt;plugin interceptor=&quot;com.jd.sql.analysis.core.SqlAnalysisAspect&quot; &gt;\n            &lt;property name=&quot;sqlReplaceModelSwitch&quot; value=&quot;true&quot;\/&gt;\n            &lt;property name=&quot;duccAppName&quot; value=&quot;workbench-backend&quot;\/&gt;\n            &lt;property name=&quot;duccUri&quot; value=&quot;ucc:\/\/workbench-backend:2d6991cb865f4e6bac6c3e1cf7794cdf@test.ducc.jd.local\/v1\/namespace\/workbench_backend\/config\/default\/profiles\/test?longPolling=60000&amp;necessary=false&quot;\/&gt;\n            &lt;property name=&quot;duccMonitorKey&quot; value=&quot;sqlReplaceConfig&quot;\/&gt;\n        &lt;\/plugin&gt;\n    &lt;\/plugins&gt;\n&lt;\/configuration&gt;<\/code><\/pre>\n<p>\u53d1\u73b0\u6162sql<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043977194\" alt=\"\" title=\"\" loading=\"lazy\">[]()<\/p>\n<p>ducc\u914d\u7f6e<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043977195\" alt=\"\" title=\"\" loading=\"lazy\">[]()<\/p>\n<p>\u7ebf\u4e0asql\u88ab\u52a8\u6001\u66ff\u6362<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043977196\" alt=\"\" title=\"\" loading=\"lazy\">[]()<\/p>\n<p>\u6ce8\u610f\uff1a\u529f\u80fd\u6b63\u5f0f\u4fee\u590d\u540e\uff0c\u9700\u53bb\u6389\u8be5\u914d\u7f6e\uff0c\u8be5\u529f\u80fd\u4ec5\u4f9b\u5e94\u6025\u5904\u7406\u7ebf\u4e0a\u95ee\u9898\uff0c\u4e0d\u5efa\u8bae\u4f5c\u4e3a\u529f\u80fd\u957f\u671f\u4f7f\u7528<\/p>\n<h2>\u6027\u80fd\u6d4b\u8bd5<\/h2>\n<p>\u6d4b\u8bd5\u73af\u5883\u5343\u6b21\u666e\u901asql\u67e5\u8be2\uff0c\u6bcf\u79cd\u573a\u666f\u8fdb\u884c\u4e865\u6b21\u6d4b\u8bd5<\/p>\n<p>\u672a\u542f\u7528\u63d2\u4ef6\u8017\u65f6\uff1a11108ms\uff0c10237ms\uff0c9482ms\uff0c7938ms\uff0c8196ms<\/p>\n<p>\u5f00\u542fsql\u5206\u6790\u8017\u65f6\uff1a16619ms\uff0c17333ms\uff0c16321ms\uff0c19057ms\uff0c18164ms<\/p>\n<p>\u5b9e\u9645\u914d\u7f6e\uff0c\u53ea\u6709\u9996\u6b21\u6267\u884c\u6216\u8005\u95f4\u9694\u65f6\u95f4\u6267\u884c\uff0c\u5355\u6b21\u5f71\u54cd10ms\u5de6\u53f3\uff09<\/p>\n<p>\u5f00\u542fsql\u66ff\u6362\u8017\u65f6\uff1a10642ms\uff0c8803ms\uff0c8353ms\uff0c8830ms\uff0c9170ms<\/p>\n<p>\u57fa\u672c\u65e0\u5f71\u54cd<\/p>\n<h2>\u9002\u7528\u573a\u666f<\/h2>\n<p>1\u3001\u6162sql\u9884\u9632<\/p>\n<p>2\u3001\u7ebf\u4e0a\u95ee\u9898\u6b62\u635f<\/p>\n<h2>\u4f18\u52bf<\/h2>\n<p>1\u3001\u6838\u5fc3\u4f18\u52bf\uff1a\u6267\u884c\u65f6\u5206\u6790sql\uff0c\u533a\u522b\u4e8e\u4f20\u7edf\u7684\u4f9d\u8d56sql\u6267\u884c\u8017\u65f6\u6765\u8bc4\u4f30\u6162sql\uff0c\u76f4\u63a5\u57fa\u4e8e\u8bed\u6cd5\u548c\u7d22\u5f15\u8fdb\u884c\u524d\u7f6e\u5206\u6790\uff0c\u4e0d\u4ec5\u80fd\u9884\u9632\u67d0\u4e9b\u574fsql\u5728\u4e0a\u7ebf\u540e\u53d1\u73b0\u662f\u6162sql\uff0c\u8fd8\u80fd\u7ed9\u51fasql\u4f18\u5316\u5efa\u8bae\uff0c\u53ef\u4ee5\u5927\u9650\u5ea6\u7684\u907f\u514d\u7ebf\u4e0a\u4ea7\u751f\u6162sql\u3002\u652f\u6301\u52a8\u6001\u5bf9\u7ebf\u4e0asql\u8fdb\u884c\u66ff\u6362\uff0c\u53ef\u4ee5\u5bf9\u7ebf\u4e0a\u95ee\u9898\u5feb\u901f\u6b62\u635f\u3002<\/p>\n<p>2\u3001\u6027\u80fd\uff1a\u57fa\u4e8e\u6027\u80fd\u548c\u4e0d\u540c\u7684\u4f7f\u7528\u573a\u666f\u8003\u8651\uff0c\u652f\u6301\u5b9a\u5236\u5316\u914d\u7f6e\uff0c\u6bcf\u4e2asql\u662f\u5426\u4ec5\u8fdb\u884c\u4e00\u6b21\u68c0\u67e5\u3001\u6216\u8005\u6309\u67d0\u4e2a\u65f6\u95f4\u95f4\u9694\u8fdb\u884c\u914d\u7f6e\u3002sql\u66ff\u6362\u51e0\u4e4e\u65e0\u635f\u8017\u3002<\/p>\n<p>3\u3001\u6269\u5c55\uff1a\u57fa\u4e8e\u540e\u7eedsql\u8bc4\u5206\u89c4\u5219\u7684\u6269\u5c55\u3001\u4ee5\u53ca\u5206\u6790\u7ed3\u679c\u4ee5\u4e0d\u540c\u7684\u65b9\u5f0f\u8f93\u51fa\u7684\u8003\u8651\uff0c\u652f\u6301\u8bc4\u5206\u89c4\u5219\u3001\u8f93\u51fa\u65b9\u5f0f\u7684\u81ea\u5b9a\u4e49\u6269\u5c55\u3002<\/p>\n<p>4\u3001\u6210\u672c\uff1a\u63a5\u5165\u6210\u672c\u4f4e\uff0c\u65e0\u4ee3\u7801\u4fb5\u5165\u3002<\/p>\n<blockquote>\n<p>\u4f5c\u8005\uff1a\u4eac\u4e1c\u7269\u6d41 \u6248\u6d77\u6d9b<\/p>\n<p>\u6765\u6e90\uff1a\u4eac\u4e1c\u4e91\u5f00\u53d1\u8005\u793e\u533a<\/p>\n<\/blockquote>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000043977188\">https:\/\/segmentfault.com\/a\/1190000043977188<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f \u5927\u4fc3\u5907\u6218\uff0c\u6700\u5927\u7684\u9690\u60a3\u9879\u4e4b\u4e00\u5c31\u662f\u6162sql\uff0c\u5e26\u6765\u7684\u7834\u574f\u6027\u6700\u5927\uff0c\u4e5f\u662f\u65e5\u5e38\u5de5\u4f5c\u4e2d\u7ecf\u5e38\u5e26\u6765\u6574\u4e2a\u5e94\u7528\u6296\u52a8\u7684\u6700\u5927\u9690\u60a3\uff0c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10008048","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10008048"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008048\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10008048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10008048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10008048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}