{"id":4026,"date":"2012-11-24T22:37:02","date_gmt":"2012-11-24T14:37:02","guid":{"rendered":"http:\/\/www.orczhou.com\/?p=4026"},"modified":"2012-11-24T22:38:35","modified_gmt":"2012-11-24T14:38:35","slug":"mysql-source-code-range-optimize-data-structure","status":"publish","type":"post","link":"https:\/\/www.orczhou.com\/index.php\/2012\/11\/mysql-source-code-range-optimize-data-structure\/","title":{"rendered":"MySQL\u6e90\u7801\uff1aRange\u4f18\u5316\u76f8\u5173\u7684\u6570\u636e\u7ed3\u6784"},"content":{"rendered":"<style>\n#content h3{\n  color:red;\n  font-size:14px;\n}\n#content h4{\n  color:blue;\n  font-size:14px;\n}\n#content blockquote{\n  font-family:\"Courier New\",Courier,monospace;\n  white-space:pre;\n}\n#content h5{\n  text-indent:2em;\n}\n<\/style>\n<p><a href=\"http:\/\/hedengcheng.com\/?p=372\" target=\"_blank\">\u767b\u535a\u5f00\u4e86\u4e00\u4e2a\u5934<\/a>\uff0c\u5e0c\u671b\u80fd\u591f\u5f80\u524d\u8d70\u4e00\u70b9\u3002\u6cdb\u8bfb\u4e86\u6574\u4e2aMySQL Range\u4f18\u5316\u7684\u76f8\u5173\u4ee3\u7801\uff0c\u8fd9\u91cc\u5c06\u603b\u7ed3Range\u4f18\u5316\u76f8\u5173\u7684\u6570\u636e\u7ed3\u6784\u3002\u672c\u6587\u4e0d\u662f\u4ece\u5b8f\u89c2(High Level)\u89d2\u5ea6\u4ecb\u7ecdRange\u4f18\u5316\u76f8\u5173\u5185\u5bb9\uff0c\u5982\u679c\u770b\u5ba2\u5bf9\u6b64\u611f\u5174\u8da3\uff0c\u5efa\u8bae\u7ed5\u8fc7\u672c\u6587\uff0c\u76f4\u63a5\u9605\u8bfb\u53c2\u8003\u6587\u732e\uff0c\u76f8\u4fe1\u4f1a\u6709\u6536\u83b7\u3002<\/p>\n<p>\u5df2\u7ecf\u8fde\u7eed\u5199\u4e86\u51e0\u7bc7\u5173\u4e8e\u4f18\u5316\u5668\u76f8\u5173\u7684\u6570\u636e\u7ed3\u6784\u7684\u535a\u5ba2\u4e86\uff0c\u53ea\u662f\u5e0c\u671b\u9700\u8981\u7684\u4eba\u662f\u5728\u9700\u8981\u7684\u65f6\u5019\u80fd\u591f\u770b\u5230\u3002<\/p>\n\n<h3>1. \u80cc\u666f\u77e5\u8bc6<\/h3>\n<p>\u5728\u5f00\u59cb\u4ecb\u7ecdRange\u7684\u4e3b\u8981\u6570\u636e\u7ed3\u6784\u4e4b\u524d\uff0c\u6211\u4eec\u5148\u770bRange\u4f18\u5316\u7684\u4e00\u4e9b\u6982\u5ff5\u548c\u80cc\u666f\u3002\u4f9d\u65e7\u5efa\u8bae\u5148\u9605\u8bfb\u53c2\u8003\u6587\u4ef6\u7684[1-8]\uff0cSergey Petrunya\u5199\u7684PPT\u548c\u6587\u6863\u8d28\u91cf\u90fd\u5f88\u9ad8\uff0c\u5f88\u591a\u56fe\u793a\uff0c\u975e\u5e38\u76f4\u89c2\u7684\u5c55\u793a\u4e86\u539f\u7406\u3002<\/p>\n<p>(1) \u4ec0\u4e48\u662fRange\u6761\u4ef6? \u53c2\u8003<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/range-optimization.html\" target=\"_blank\">Range Optimization@MySQL Manual<\/a> <a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/range-access-single-part.html\" target=\"_blank\">\u5355\u5217Range<\/a>\u548c<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/range-access-multi-part.html\" target=\"_blank\">\u591a\u5217Range<\/a><\/p>\n<p>(2)  \u7ed9\u5b9a\u4e00\u4e2aKEY(key1)\u5bf9\u5e94\u7684WHERE\u6761\u4ef6\uff0c\u5982\u4f55\u5c06\u5176\u8f6c\u5316\u6210\u4e00\u4e2aRange\uff0c\u4e0b\u9762\u662f&#8221;\u7b80\u8ff0&#8221;\uff0c\u8be6\u7ec6\u53c2\u8003<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/range-access-single-part.html\" target=\"_blank\">\u5355\u5217Range<\/a>\uff1a<\/p>\n<pre><blockquote>SELECT * FROM t1 WHERE\r\n  (key1 < 'abc' AND (key1 LIKE 'abcde%' OR key1 LIKE '%b')) OR\r\n  (key1 < 'bar' AND nonkey = 4) OR\r\n  (key1 < 'uux' AND key1 > 'z');<\/blockquote><\/pre>\n<h4>1.1 \u66ff\u6362\u6240\u6709\u975eRANGE\u67e5\u8be2\u4e3aTRUE<\/h4>\n<p><!--more--><\/p>\n<p>\u5148\u5c06\u6240\u6709\u975eRANGE\u67e5\u8be2\u4e3aTRUE\uff0c\u8fd9\u6837\u5c31\u4e0d\u4f1a\u6f0f\u6389\u4efb\u4f55\u6570\u636e,\u8fd9\u91cc\u6709key1 LIKE &#8216;%b&#8217;  nonkey = 4\uff0c\u6240\u4ee5\u6709\uff1a<\/p>\n<pre><blockquote>    (key1 < 'abc' AND (key1 LIKE 'abcde%' OR TRUE)) OR\r\n    (key1 < 'bar' AND TRUE) OR\r\n    (key1 < 'uux' AND key1 > 'z')<\/blockquote><\/pre>\n<h4>1.2 \u79fb\u9664\u6052\u771f\uff0c\u6216\u8005\u6052\u5047\u7684\u8868\u8fbe\u5f0f<\/h4>\n<pre><blockquote>    (key1 < 'abc' AND (key1 LIKE 'abcde%' OR TRUE)) OR\r\n    (key1 < 'bar' AND TRUE) OR\r\n    (key1 < 'uux' AND key1 > 'z')<\/blockquote><\/pre>\n<p>    \u8fd9\u5176\u4e2d\uff0c\u6709\uff1a<\/p>\n<pre><blockquote>    (key1 LIKE 'abcde%' OR TRUE) \u6052\u771f \r\n    (key1 < 'uux' AND key1 > 'z') \u6052\u5047<\/blockquote><\/pre>\n<p>    \u7ee7\u7eed\u66ff\u6362\uff1a<\/p>\n<pre><blockquote>    (key1 < 'abc' AND TRUE) OR (key1 < 'bar' AND TRUE) OR (FALSE)<\/blockquote><\/pre>\n<p>\u79fb\u9664\u4e0d\u5fc5\u8981\u7684\u5206\u652f\uff0c\u79fb\u9664\u539f\u5219\uff1a<\/p>\n<pre><blockquote>    OR\u5206\u652f\u4e2d\u5982\u679c\u6052\u5047\uff0c\u5219\u53ef\u4ee5\u79fb\u9664\uff1b\r\n    OR\u5206\u652f\u4e2d\u5982\u679c\u6052\u771f\uff0c\u5219\u6574\u4e2aOR\u6052\u771f\r\n    AND\u5206\u652f\u4e2d\u5982\u679c\u6052\u5047\uff0c\u5219\u6574\u4e2aAND\u6052\u5047\r\n    AND\u5206\u652f\u4e2d\u5982\u679c\u6052\u771f\uff0c\u5219\u53ef\u4ee5\u79fb\u9664<\/blockquote><\/pre>\n<p>\u8fd9\u662f\u4e00\u4e2a\u9012\u5f52\u7684\u8fc7\u7a0b<\/p>\n<h4>1.3 \u9012\u5f52\u7ed3\u675f<\/h4>\n<pre><blockquote>    (key1 < 'abc') OR (key1 < 'bar')<\/blockquote><\/pre>\n<h4>1.4 \u5408\u5e76\u6709\u8986\u76d6\u7684\u533a\u95f4<\/h4>\n<p>\u8fd9\u91cc\u7b2c\u4e00\u4e2aRANGE\u662f\u7b2c\u4e8c\u4e2aRANGE\u7684\u5b50\u96c6\uff0c\u8fd9\u91cc\u53c8\u662fOR\uff0c\u6240\u4ee5\u5408\u5e76<\/p>\n<pre><blockquote>    (key1 < 'bar')<\/blockquote><\/pre>\n<h3>2 Range\u7684\u6570\u636e\u7ed3\u6784<\/h3>\n<p>\u5bf9\u4efb\u4f55\u7684WHERE\u6761\u4ef6\uff0cMySQL\u5728\u5c1d\u8bd5Range\u4f18\u5316\u65f6\uff0c\u4f1a\u6784\u9020\u53ef\u4ee5\u4e2aSEL_TREE\u5bf9\u8c61\u5b58\u50a8\u6240\u6709\u7684Range\u3002\u6bcf\u4e00\u4e2a\u7d22\u5f15\uff0c\u5bf9\u5e94\u4e00\u4e2aRange\uff0c\u6240\u4ee5\u6709\uff1a<\/p>\n<pre><blockquote>range_cond = (cond_key_1 AND cond_key_2 AND ... AND cond_key_N)<\/blockquote><\/pre>\n<p>\u8bf4\u660e\uff1a\u9488\u5bf9\u67d0\u4e2a\u7d22\u5f15key_i\uff0cMySQL\u4f1a\u6784\u9020\u5bf9\u5e94\u7684RANGE\uff0c\u8bb0\u4e3acond_key_1(\u5982\u4f55\u6839\u636e\u7d22\u5f15\u7b80\u5316WHERE\u6761\u4ef6?\u53c2\u8003\u672c\u6587\u7b2c\u4e00\u8282)\u3002MySQL\u4f1a\u8bc4\u4f30\u6240\u6709\u8fd9\u4e9b\u7d22\u5f15\u5bf9\u5e94\u7684RANGE\uff0c\u9009\u62e9\u4ee3\u4ef7\u6700\u5c0f\u7684\u4f5c\u4e3a\u6267\u884c\u8ba1\u5212\u7684\u4e00\u90e8\u5206\u3002<\/p>\n<h4>2.1 &#8220;\u7b80\u5355\u533a\u95f4&#8221;<\/h4>\n<p>\u5bf9\u67d0\u4e2a\u7d22\u5f15\uff0cMySQL\u4f7f\u7528SEL_ARG\u5bf9\u8c61\u6765\u4ee3\u8868\u4e00\u4e2a&#8221;\u7b80\u5355\u533a\u95f4&#8221;\uff0c\u8fdb\u4e00\u6b65SEL_ARG\u6784\u6210\u6574\u4e2acond_key_1\u5bf9\u8c61\u3002\u5148\u6765\u770b\u770b\u4ec0\u4e48\u662f\u4e00\u4e2a\u7b80\u5355\u533a\u95f4:<\/p>\n<pre><blockquote> min_value <=?  table.keypartX  <=? max_value\r\n(\"?\" \u8868\u793a\u201d=\u201d\u53ef\u6709\u53ef\u65e0)<\/blockquote><\/pre>\n<p>\u8fd9\u53ef\u4ee5\u662f\u4e00\u4e2a\u975e\u7a7a\u7684\u4efb\u4f55\u7c7b\u578b\u7684\u533a\u95f4\uff1a<\/p>\n<pre><blockquote>(-INF,9) (-INF,9] (9,INF) [9,INF) (8,9) (8,9] [8,9)<\/blockquote><\/pre>\n<p>\u4efb\u4f55\u4e00\u4e2a\u590d\u6742\u7684Range\u8868\u8fbe\u5f0f\uff0c\u90fd\u662f\u7531\u591a\u4e2a&#8221;\u7b80\u5355\u533a\u95f4&#8221;\u6784\u6210\u3002<\/p>\n<h4>2.2 SEL_ARG\uff1a\u63cf\u8ff0&#8221;\u7b80\u5355\u533a\u95f4&#8221;\u7684\u5bf9\u8c61<\/h4>\n<p>\u4f8b\u5982\u6709\u5982\u4e0b\u67e5\u8be2\uff1a<\/p>\n<pre><blockquote>select * from tmp_sel_arg where kp1 <= 1 and kp1 > 0;<\/blockquote><\/pre>\n<p>\u90a3\u4e48\u5bf9\u5e94SEL_ARG\u5bf9\u8c61\u8868\u793a\u4e86\u533a\u95f4(-INF,1],\u5177\u4f53\u7684\uff1a<\/p>\n<pre><blockquote>(gdb) p tree->keys[0]\r\n$93 = (SEL_ARG *) 0x7f6518008bb8\r\n(gdb) p *tree->keys[0]\r\n$94 = {\r\n  min_flag = 4 '\\004', \r\n  max_flag = 0 '\\000', \r\n  maybe_null = 1 '\\001', \r\n  field = 0x7f651400d2f0, \r\n  min_value = 0x7f6518008e60 \"\", \r\n  max_value = 0x7f6518008bb0 \"\", \r\n  left = 0xcecac0, \r\n  ......\r\n  color = SEL_ARG::BLACK, \r\n  type = SEL_ARG::KEY_RANGE\r\n}<\/blockquote><\/pre>\n<li>min_flag = 4 NEAR_MIN \u5373\u4e0b\u754c\u4e3a\u5f00\u533a\u95f4<\/li>\n<li>max_flag = 0 \u8868\u793a\u4e0a\u754c\u4e3a\u95ed\u533a\u95f4<\/li>\n<pre><blockquote>516 #define NO_MIN_RANGE    1                         \r\n517 #define NO_MAX_RANGE    2\r\n518 #define NEAR_MIN        4\r\n519 #define NEAR_MAX        8\r\n520 #define UNIQUE_RANGE    16\r\n...<\/blockquote><\/pre>\n<li>maybe_null = 1 \u8868\u793a\u8fd9\u4e2akey part\u53ef\u4ee5\u4e3a\u7a7a\uff0c\u5b58\u50a8\u503c\uff0c\u7b2c\u4e00\u4e2a\u5b57\u8282\u9884\u7559<\/li>\n<li>min_value = 0x7f6518008e60 &#8220;&#8221; \u8868\u793a\u53d6\u503c\u4e0b\u5c4a\uff0c\u8fd9\u91cc\u5b58\u50a8\u7684\u503c\u4e3a0<\/li>\n<li>max_value = 0x7f6518008bb0 &#8220;&#8221; \u8868\u793a\u53d6\u503c\u4e0a\u754c\uff0c\u8fd9\u91cc\u5b58\u50a8\u7684\u503c\u4e3a1\uff0c\u6240\u4ee5\uff0c\u8fd9\u4e2aSEL_ARG\u8868\u793a\u7684\u533a\u95f4\u4e3a\uff1a<\/li>\n<pre><blockquote>(0,1]<\/blockquote><\/pre>\n<li>left\/right\/parent\/prev\/next_key_part\/color\u7b49\u6307\u9488\u672c\u6587\u540e\u7eed\u4ecb\u7ecd<\/li>\n<h4>2.3 SEL_ARG\u94fe\u8868\uff1a\u590d\u6742\u7684\u533a\u95f4<\/h4>\n<p>\uff08\u9605\u8bfb\u672c\u6bb5\uff0c\u53ef\u4ee5\u5148\u9605\u8bfbMySQL\u6e90\u7801\u4e2d\u5173\u4e8eSEL_ARG\u7684\u6ce8\u91ca\u90e8\u5206\uff1aA construction block of the SEL_ARG-graph\u3002opt_range.cc\uff09<\/p>\n<p>\u8fd9\u6b21\u6211\u5148\u6765\u770b\u4e00\u4e2a\u590d\u6742\u7684WHERE\u6761\u4ef6\uff0c\u53ca\u5176\u5bf9\u5e94\u7684SER_ARG\u7ed3\u6784\uff0c\u7136\u540e\u901a\u8fc7\u51e0\u4e2a\u4ece\u7b80\u5355\u5230\u590d\u6742\u7684\u6848\u4f8b\uff0c\u6765\u5206\u6790\u4e4b\u3002\u5047\u8bbe\u6709\u5982\u4e0b\u7684WHERE\u6761\u4ef6\uff0c\u5bf9\u5e94\u7684\u7d22\u5f15\u4e3a(kp1,kp2,kp3)\uff1a<\/p>\n<pre><blockquote>select * from tmp_sel_arg where \r\n    (kp1 < 1 AND kp2=5 AND (kp3=10 OR kp3=12)) OR \r\n    (kp1=2 AND (kp3=11 OR kp3=14)) OR \r\n    (kp1=3 AND (kp3=11 OR kp3=14));<\/blockquote><\/pre>\n<p>\u6bcf\u4e00\u4e2a&#8221;\u7b80\u5355\u533a\u95f4&#8221;\u90fd\u7531\u4e00\u4e2aSEL_ARG\u8868\u793a\uff0c\u5bf9\u76f8\u540c\u7684key part\uff0c\u5982\u679c\u662f\u591a\u4e2aOR\u6761\u4ef6\u5219\u7528\u6307\u9488prev\/next\u94fe\u63a5\uff0c\u5982\u679c\u662f\u76f8\u5173\u7684\u591a\u4e2akey part\u5219\u7528next_key_part\u6307\u9488\u94fe\u63a5\u3002\u4e8e\u662f\u53c8\u5982\u4e0b\u5173\u7cfb\u56fe\uff1a<\/p>\n<pre><blockquote>                   $                            $ \r\n                   $                            $ \r\n    SEL_ARG(-&infin;, 1) $ ===>  SEL_ARG  [5,5] ===>  $ SEL_ARG [10,10] \r\n           |^      $                            $        |^\r\n       next||      $                            $    next||\r\n           ||prev  $                            $        ||prev\r\n           ||      $                            $        v\r\n           ||      $                            $ SEL_ARG [12,12]\r\n           ||      $                            $ \r\n           v|      $                            $ \r\n    SEL_ARG [2, 2] $=== next_key_part =====|    $ \r\n           |^      $                       |    $\r\n       next||      $                       |===>$\r\n           ||prev  $                       |===>$ SEL_ARG[11,11]    \r\n           v|      $                       |    $         |^        \r\n    SEL_ARG [3, 3] $=== next_key_part =====|    $     next||   \r\n                   $                            $         ||prev\r\n                   $                            $         v|     \r\n                                                  SEL_ARG[14,14]<\/blockquote><\/pre>\n<p>\u4e0a\u56fe\u4e2d\uff0c\u6c34\u5e73\u65b9\u5411\u4f7f\u7528\u6307\u9488next_key_part\u4e32\u8054\uff0c\u8868\u793a\u591a\u4e2akey part\u4e4b\u95f4\u7684and\u5173\u7cfb\u3002\u5782\u76f4\u90e8\u5206\uff0c\u662f\u591a\u4e2aOR\u6761\u4ef6\u5173\u8054\u76f8\u540ckey part\uff0c\u901a\u8fc7\u6307\u9488next\/prev\u5173\u8054\u3002<\/p>\n<p>\u9664\u4e86\u4e0a\u9762\u7684\u6307\u9488next\/prev\u4ee5\u53canext_key_part\uff0cSEL_ARG\u5bf9\u8c61\u8fd8\u6709\u4e09\u4e2a\u6307\u9488left\/right\/parent\u6307\u9488\uff0c\u540c\u4e00\u4e2akey part\u7684\u4e0d\u540cSEL_ARG\u5bf9\u8c61\u7ec4\u6210\u7684\u4e00\u9897\u7ea2\u9ed1\u6811\u5c31\u662f\u9760\u8fd9\u4e09\u4e2a\u6307\u9488\u94fe\u63a5\u3002\u5728\u4e0a\u56fe\u4e2dSEL_ARG(-INF,1) SEL_ARG [2, 2] SEL_ARG [3, 3]\u901a\u8fc7\u8fd9\u4e09\u4e2a\u6307\u9488\u6784\u6210\u4e00\u9897\u7ea2\u9ed1\u6811\u3002<\/p>\n<p>\u4e0a\u9762\u8fd9\u4e2a\u6848\u4f8b\u6bd4\u8f83\u590d\u6742\uff0c\u4f46\u662f\u5b8c\u6574\u7684\u5c55\u793a\u4e86SEL_ARG\u8868\u793a\u4e00\u4e2a\u590d\u6742\u7684RANGE\u6761\u4ef6\u3002\u4e0b\u9762\u6211\u6765\u770b\u51e0\u4e2a\u7b80\u5355\u6848\u4f8b\uff0c\u6765\u9010\u6b65\u8ba4\u8bc6SEL_ARG\u5982\u4f55\u63cf\u8ff0\u4e00\u4e2a\u5b8c\u6574\u7684RANGE\u6761\u4ef6\u3002\u6700\u540e\uff0c\u518d\u56de\u5934\u6765\u770b\u770b\u4e0a\u9762\u8fd9\u4e2a\u7ed3\u6784\u3002<\/p>\n<h5>2.3.1 \u7b80\u5355\u6761\u4ef6 WHERE id > 10<\/h5>\n<p>\u8fd9\u662f\u4e00\u4e2a\u6700\u7b80\u5355\u7684\u533a\u95f4\u3002SEL_ARG(10,&infin;)\uff0c\u6709\u6807\u5fd7\u4f4dNEAR_MIN\u548cNO_MAX_RANGE\uff0c\u4ec5\u5355\u4e2aSEL_ARG\u5bf9\u8c61\uff0c\u6240\u6709\u6307\u9488\u90fd\u65e0\u6548\u3002<\/p>\n<h5>2.3.2 WHERE id > 2 and id < 10<\/h5>\n<p>id>2\u548cid<10\u662f\u4e24\u4e2a\u53ef\u4ee5\u5408\u5e76\u7684SEL_ARG\uff0c\u5408\u5e76\u540e\u4e3aSEL_ARG(2,10)\uff0c\u4e24\u8fb9\u5f00\u533a\u95f4\uff0c\u6545\u6709\u6807\u5fd7\u4f4dNEAR_MIN NEAR_MAX\u3002\n\n\n\n<h5>2.3.3 WHERE id > 10 or id &lt;= 2<\/h5>\n<p>\u8fd9\u4e2aWHERE\u6761\u4ef6\u4e2d\u6709\u4e24\u4e2aSEL_ARG\uff0c\u5206\u522b\u4e3aSEL_ARG(10,&infin;)\u548cSEL_ARG (-&infin;,2]\u3002\u8fd9\u662f\u8fd9\u4e24\u4e2a\u6761\u4ef6\u662f\u7d22\u5f15\u7684\u540c\u4e00\u4e2akey part\uff0c\u7528OR\u5173\u8054\uff0c\u6240\u4ee5\u8fd9\u4e24\u4e2aSEL_ARG\u4e00\u65b9\u9762\u7528next\/prev\u6307\u9488\u5173\u8054\uff0c\u53e6\u4e00\u65b9\u9762\u6307\u9488left\/right\/parent\u4e5f\u8ba9\u4ed6\u4eec\u6784\u6210\u4e00\u9897\u7b80\u5355\u7684\u7ea2\u9ed1\u6811\uff1a<\/p>\n<pre><blockquote>                     $   \r\n\u94fe\u8868\u7ed3\u6784              $  \u7b80\u5355\u7ea2\u9ed1\u6811        \r\n    SEL_ARG (-&infin;,2]   $         SEL_ARG (10,&infin;) \r\n       |^            $             \/(black)\r\n   next||            $            \/   \r\n       ||prev        $           \/   \r\n       v|            $   SEL_ARG (-&infin;,2] \r\n    SEL_ARG (10,&infin;)   $   (red)\r\n                     $   \r\n                     $ <\/blockquote><\/pre>\n<h5>2.3.4 WHERE id > 10 or id &lt;= 2 or ( id >= 3 and id < 5 )<\/h5>\n<p>\u770b\u4e0b\u9762\u7684\u56fe\uff0c\u5982\u679c\u4f60\u771f\u662f\u4ece\u4e0a\u9762\u4e00\u76f4\u770b\u4e0b\u6765\u7684\uff0c\u5e94\u8be5\u4e0d\u9700\u8981\u6211\u89e3\u91ca\u4ec0\u4e48\u4e86\u5427\uff1a<\/p>\n<pre><blockquote>                $\r\nSEL_ARG (-&infin;,2]  $               SEL_ARG [3,5)\r\n       |^       $                   \/\\ Black\r\n   next||       $                  \/  \\\r\n       ||prev   $                 \/    \\\r\n       v|       $    SEL_ARG (-&infin;,2]   SEL_ARG (10,&infin;)\r\nSEL_ARG [3,5)   $            Red           Red\r\n       |^       $          \r\n   next||       $\r\n       ||prev   $                \r\n       v|       $       \r\nSEL_ARG (10,&infin;)  $\r\n                $<\/blockquote><\/pre>\n<h5>2.3.5 WHERE id = 7 or id > 10 or id &lt;= 2 or ( id &gt;= 3 and id < 5 )<\/h5>\n<p>\u770b\u4e0b\u9762\u7684\u56fe\uff0c\u5982\u679c\u4f60\u771f\u662f\u4ece\u4e0a\u9762\u4e00\u76f4\u770b\u4e0b\u6765\u7684\uff0c\u5e94\u8be5\u4e0d\u9700\u8981\u6211\u89e3\u91ca\u4ec0\u4e48\u4e86\u5427\uff1a<\/p>\n<pre><blockquote>                  $\r\nSEL_ARG [7,7]     $\r\n       |^         $   RB-Tree                   \r\n   next||         $                        \r\n       ||prev     $                  SEL_ARG [7,7]\r\n       v|         $                      \/\\ Black   \r\nSEL_ARG (10,&infin;)    $                     \/  \\           \r\n       |^         $                    \/    \\     \r\n   next||         $       SEL_ARG (-&infin;,2]    SEL_ARG (10,&infin;)\r\n       ||prev     $             \/\\Black              Red\r\n       v|         $            \/  \\        \r\nSEL_ARG (-&infin;,2]    $           \/    \\\r\n       |^         $               SEL_ARG [3,5)         \r\n   next||         $                      RED\r\n       ||prev     $\r\n       v|         $\r\nSEL_ARG [3,5)     $\r\n                  $<\/blockquote><\/pre>\n<p>\u5230\u8fd9\u91cc\uff0c\u5c31\u53ef\u4ee5\u518d\u56de\u5934\u770b\u770b2.3\u8282\u7ed9\u51fa\u7684\u590d\u6742\u6848\u4f8b\u4e86\u3002<\/p>\n<h4>2.4 SEL_ARG\u94fe\u8868\u7ed3\u6784\u7684\u6784\u9020<\/h4>\n<p>\u672c\u6587\u4e0d\u6253\u7b97\u8be6\u8ff0SEL_ARG\u94fe\u8868\u6784\u9020\u8be6\u7ec6\u8fc7\u7a0b\uff08\u5982\u679c\u540e\u7eed\u8fd8\u6709\u8010\u5fc3\u7684\u8bdd\uff0c\u4f1a\u5199\u51fa\u6765\uff09\uff0c\u8fd9\u91cc\u4ec5\u7ed9\u51fa\u4e00\u4e2a\u7b80\u5355\u7684\u8c03\u7528\u6808\uff1a<\/p>\n<pre><blockquote>#0  get_mm_leaf                   # \u6839\u636e\u7b80\u5355\u8c13\u8bcd\uff0c\u6784\u5efaSEL_ARG\u5bf9\u8c61\r\n#1  get_mm_parts                  # \u6839\u636e\u7b80\u5355\u8c13\u8bcd\uff0c\u5c06\u4e0a\u4e00\u6b65\u7684SEL_ARG\u6784\u5efa\uff0c\u6dfb\u52a0\u5230SEL_TREE(\u4f7f\u7528\u51fd\u6570sel_add)\r\n#2  get_func_mm_tree>             # \u6839\u636e\u8c13\u8bcdItem_func::NE_FUNC\/BETWEEN\/IN_FUNC\uff0c\u5206\u522b\u6784\u5efaSEL_TREE\r\n#3  get_full_func_mm_tree>        # \u5904\u7406\u201d\u7279\u6b8a\u7684\u7b49\u53f7\u201d \u8fd9\u662f\u5565\uff0c\u8fd8\u6ca1\u6709\u592a\u660e\u767d\r\n#4  get_mm_tree                   # <\u9012\u5f52\u6839\u636e\u7b80\u5355\u8c13\u8bcd\uff0c\u6784\u5efaSEL_TREE\u5bf9\u8c61>\r\n#5  get_mm_tree(\u9012\u5f52)              # \u6839\u636eWHERE\u6761\u4ef6\uff0c\u6784\u5efaSEL_TREE\u5bf9\u8c61\r\n#6  SQL_SELECT::test_quick_select # \u6839\u636eWHERE\u6761\u4ef6\uff0c\u6784\u5efaSEL_TREE\uff0c\u5e76\u8bc4\u4f30\u6bcf\u4e2aRANGE\u627e\u5230\u591a\u5c11\u6761\u8bb0\u5f55\r\n#7  get_quick_record_count        # \u6784\u5efaRANGE\u4f18\u5316\u7684SQL_SELECT\u5bf9\u8c61\r\n#8  make_join_statistics          # ...\r\n#9  JOIN::optimize <\/blockquote><\/pre>\n<h4>2.5 \u5408<\/h4>\n<p>\u6240\u4ee5\u5bf9\u4e8e\u4e00\u4e2a\u590d\u6742\u7684WHERE\u6761\u4ef6\uff0cMySQL\u4f1a\u9488\u5bf9\u6bcf\u4e00\u4e2a\u53ef\u80fd\u4f7f\u7528Range\u7684\u7d22\u5f15(possable key\u521d\u59cb\u5316\u5728\u53e6\u4e00\u7bc7\u6587\u7ae0\u4e2d\u4ecb\u7ecd\u8fc7)\uff0c\u751f\u6210\u4e00\u4e2a\u5bf9\u5e94\u7684SEL_ARG\u94fe\u8868\u7ed3\u6784\uff0c\u53ef\u4ee5\u7528cond_key_i\u8868\u793a\uff0c\u90a3\u4e48\u6574\u4e2aRANGE\u6761\u4ef6\u5c31\u53ef\u4ee5\u770b\u4f5c\u4e0b\u9762\u7684\u7ed3\u6784\uff1a<\/p>\n<pre><blockquote>range_cond = (cond_key_1 AND cond_key_2 AND ... AND cond_key_N)<\/blockquote><\/pre>\n<p>\u5728MySQL\u4e2dcond_key_i\u5176\u5b9e\u5c31\u662f\u4e00\u4e2aSEL_ARG\u6307\u9488\uff0c\u8be5\u6307\u5411\u7b2c\u4e00\u4e2akey part\u7684\u7ea2\u9ed1\u6811\u7684\u6839\u8282\u70b9\u3002\u6240\u6709\u7684cond_key_i\u6570\u7ec4\u5b58\u653eSEL_TREE\u7684\u6210\u5458keys\u4e2d\u3002SEL_TREE\u5bf9\u8c61\u5728get_mm_tree\u51fd\u6570\u4e2d\u6784\u9020\u3002<\/p>\n<h3>3. RANGE\u4ee3\u4ef7\u7684\u8bc4\u4f30<\/h3>\n<p>\u5982\u679c\u4f60\u662f\u6cdb\u8bfb\u65b9\u5f0f\u8bfb\u5230\u8fd9\u91cc\uff0c\u90a3\u4e48\u5efa\u8bae\u4f60\u518d\u56de\u5934\u770b\u770bSEL_ARG\u7684\u6570\u636e\u7ed3\u6784\uff0c\u60f3\u60f3\u5982\u679c\u8981\u904d\u5386\u8fd9\u68f5\u6811\u3002\u5982\u679c\u662f\u4ee5\u7cbe\u5ea6\u7684\u6001\u5ea6\u770b\u5230\u4e86\u8fd9\u91cc\uff0c\u90a3\u4e48\uff0c\u8c22\u8c22\uff0c\u5f88\u8363\u5e78\u80fd\u591f\u5206\u4eab\u4e00\u70b9\u70b9\u4e1c\u897f\uff0c\u76f8\u4fe1\u7a0d\u52a0\u601d\u8003\uff0c\u4fbf\u80fd\u591f\u4f53\u4f1a\u5230\uff0c\u5e94\u8be5\u5982\u4f55\u904d\u5386\u8fd9\u9897\u6811\u4e86\u3002\u5982\u679c\u7406\u89e3\u4e86\u4e0a\u9762\u7684SEL_ARG\u7684\u7ed3\u6784\uff0c\u518d\u6765\u770bRange\u4ee3\u4ef7\u8bc4\u4f30\u5c31\u5f88\u7b80\u5355\u4e86\u3002\u4e3b\u7ebf\u5267\u60c5\u5c31\u662f\u9012\u5f52\u6574\u4e2a\u7ea2\u9ed1\u6811\uff0c\u7136\u540e\u6bcf\u6b21\u5c3d\u53ef\u80fd\u7684\u6df1\u5ea6\u4f18\u5148\u5730\u6cbf\u7740next_key_part\u8d70\u3002<\/p>\n<p>\u5199\u5f97\u6709\u70b9\u7d2f\u4e86\uff0c\u8fd9\u90e8\u5206\u4e0b\u6b21\u518d\u5199\u5427\u3002\u7b97\u4e86\uff0c\u8fd8\u662f\u4e00\u53e3\u6c14\u5199\u5b8c\u5427\u3002<\/p>\n<p>\u8fd9\u91cc\uff0c\u6211\u901a\u8fc7\u4e00\u4e2a\u6848\u4f8b\u6765\u89e3\u91caRange\u4ee3\u4ef7\u8bc4\u4f30\u7684\u8fc7\u7a0b\u3002\u6211\u4eec\u6765\u770b\u770b\u4e0b\u9762\u8fd9\u4e2aSQL\uff0c\u770b\u770b\u4ed6\u7684SEL_ARG\u7ed3\u6784\uff0c\u7136\u540e\u770b\u770bRange\u4ee3\u4ef7\u8bc4\u4f30\u7684\u9012\u5f52\u8fc7\u7a0b\uff1a<\/p>\n<pre><blockquote>select \r\n  * \r\nfrom \r\n  tmp_sel_arg \r\nwhere \r\n  (kp1 = 5 and kp2 > 10) or \r\n  (kp1 = 10 and kp3 >20) or\r\n  (kp1 =8 and kp2 = 19 and (kp3 <=10 or kp3 >15) ) or \r\n  (kp1 > 12 and kp2 =5);<\/blockquote><\/pre>\n<h4>3.1 \u6784\u5efa\u5bf9\u5e94\u7684SEL_ARG\u6811<\/h4>\n<pre><blockquote>               $                      $  \r\nSEL_ARG[5,5]   $ ===>  SEL_ARG(10,+&infin;) $ \r\n       |^      $                      $\r\n   next||      $                      $   \r\n       ||prev  $                      $  \r\n       v|      $                      $ \r\nSEL_ARG[8,8]   $ ===>  SEL_ARG[19,19] $  ===>  SEL_ARG(-&infin;,10] \r\n       |^      $                      $               |^  \r\n   next||      $                      $           next|| \r\n       ||prev  $                      $               ||prev  \r\n       ||      $                      $               v|    \r\n       ||      $                      $        SEL_ARG(15,+&infin;)\r\n       ||      $                      $        \r\n       v|      $                      $               \r\nSEL_ARG[10,10] $ =====================$=====>  SEL_ARG(20,+&infin;)\r\n       |^      $                      $        \r\n   next||      $                      $        \r\n       ||prev  $                      $        \r\n       ||      $                      $          \r\n       v|      $                      $         \r\nSEL_ARG(12,&infin;)  $ ===>  SEL_ARG[5,5]   $        \r\n               $                      $<\/blockquote><\/pre>\n<h4>3.2 &#8220;\u6df1\u5ea6\u4f18\u5148&#8221;\u904d\u5386SEL_ARG\u6811<\/h4>\n<p>\u9996\u5148\uff0c\u5bf9\u4e8e\u6bcf\u4e00\u4e2aKEY PART\u662f\u4e00\u9897\u7ea2\u9ed1\u6811\uff0c\u4f8b\u5982\uff0c\u6211\u4eec\u770b\u8fd9\u91cc\u7684\u7b2c\u4e00\u4e2akey part\u90e8\u5206\uff0c\u5373kp1\u5bf9\u5e94\u7684SEL_ARG\uff0c\u4ed6\u4eec\u6784\u6210\u7684\u7ea2\u9ed1\u6811\u5982\u4e0b\uff1a<\/p>\n<pre><blockquote>         SEL_ARG[8,8] \r\n             \/\\ Black\r\n            \/  \\    \r\n           \/    \\  \r\nSEL_ARG[5,5]  SEL_ARG[10,10]     \r\n       Black       \/\\ Black     \r\n                  \/  \\         \r\n                 \/    \\       \r\n                    SEL_ARG(12,&infin;)\r\n                        Red<\/blockquote><\/pre>\n<p>\u90a3\u4e48\uff0c\u904d\u5386\u7684\u987a\u5e8f\u662f\u5148\u4ecekp1\u7684\u8303\u56f4SEL_ARG[8,8]\u5165\u624b\uff0c\u5148\u5de6\u5b50\u6811\uff0c\u518d\u81ea\u8eab\u8282\u70b9\uff0c\u7136\u540e\u53f3\u5b50\u6811\u3002\u4e3a\u4ec0\u4e48\u8fd9\u91cc\u8bf4\u662f&#8221;\u6df1\u5ea6\u4f18\u5148&#8221;\uff0c\u4f8b\u5982\u5f53\u904d\u5386\u5230\u6839\u8282\u70b9SEL[8,8]\u65f6\uff0c\u5982\u679c\u8fd9\u4e2a\u5bf9\u8c61\u7684next_key_part\u6307\u9488\u4e0d\u4e3a\u7a7a\uff0c\u90a3\u4e48\u5c06next_key_part\u90e8\u5206\u52a0\u5165\uff1b\u5982\u679cnext_key_part\u7684left\/right\/parent\u6307\u9488\u4e0d\u4e3a\u7a7a\uff08\u5b9e\u65f6\u4e0aparent\u603b\u662f\u4e3a\u7a7a\uff0c\u56e0\u4e3anext_key_part\u603b\u662f\u6307\u5411\u7ea2\u9ed1\u6811\u7684\u6839\u8282\u70b9\uff09\uff0c\u90a3\u4e48\u5148\u904d\u5386left\u8282\u70b9\uff0c\u4ee5\u6b64\u9012\u5f52\u3002<\/p>\n<p>\u90a3\u4e48\u8fd9\u91cc\u7684\u904d\u5386\u7684\u987a\u5e8f\u662f\uff1a<\/p>\n<pre><blockquote>SEL_ARG[5,5] SEL_ARG(10,+&infin;)\r\nSEL_ARG[8,8] SEL_ARG[19,19] SEL_ARG(-&infin;,10]\r\nSEL_ARG[8,8] SEL_ARG[19,19] SEL_ARG(15,+&infin;)\r\nSEL_ARG[10,10]......(no kp2)......SEL_ARG(20,+&infin;)\r\nSEL_ARG(12,&infin;) SEL_ARG[5,5]<\/blockquote><\/pre>\n<h4>3.3 \u7b5b\u9009MySQL\u65e0\u6cd5\u5904\u7406\u7684Range<\/h4>\n<p>\u5728MySQL\u4e2d\uff0c\u5982\u679c\u662f\u4e00\u4e2a\u591a\u5217\u533a\u95f4\uff0c\u90a3\u4e48\u9664\u6700\u540e\u4e00\u5217\u4e4b\u5916\uff0c\u5176\u4ed6\u5217\u5fc5\u987b\u5b58\u5728\u4e14\u662f\u5355\u70b9\u533a\u95f4\uff0c\u624d\u80fd\u4f7f\u7528Range\u4f18\u5316\u3002\uff08\u5355\u70b9\u533a\u95f4\u662f\u6307[5,5]\u8fd9\u6837\u7684\u7b49\u503c\u533a\u95f4\uff09<\/p>\n<p>\u6240\u4ee5\uff0c\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\u4e0b\u9762\u4e24\u4e2aRange\u65e0\u6cd5\u4f7f\u7528Range\u4f18\u5316\uff0cMySQL\u76f4\u63a5\u8df3\u8fc7\uff1a<\/p>\n<pre><blockquote>SEL_ARG[10,10]......(no kp2)......SEL_ARG(20,+&infin;)\r\nSEL_ARG(12,&infin;) SEL_ARG[5,5]<\/blockquote><\/pre>\n<p>\u4ee3\u7801\u903b\u8f91\uff1a<\/p>\n<pre><blockquote>if(\r\n  key_tree->next_key_part &&  # \u662f\u5426\u6709next_key_part\r\n  key_tree->next_key_part->part == key_tree->part+1     # \u4e14next_key_part\u8ddf\u5f53\u524dkey part\u8fde\u7eed\r\n)\r\n{\r\n  if(min_key_length == max_key_length){  # \u8fd9\u662f\u6700\u540e\u4e00\u4e2akey part\r\n    #\u9012\u5f52\u8c03\u7528\r\n    goto end\r\n  }\r\n}\r\n...\r\ntable->file->records_in_range(...)\r\nend:\r\n  <\/blockquote><\/pre>\n<h4>3.4 \u8c03\u7528\u5b58\u50a8\u5f15\u64ce\u63a5\u53e3<\/h4>\n<p>\u6700\u540e\uff0cMySQL\u5c06\u9677\u5165\u5b58\u50a8\u5f15\u64ce\u63a5\u53e3records_in_range\u9884\u4f30\u5728\u8fd9\u4e2a\u8303\u56f4\u5927\u7ea6\u6709\u591a\u5c11\u6761\u8bb0\u5f55\u3002\u9884\u4f30\u7684\u529e\u6cd5\uff0c\u5404\u4e2a\u5b58\u50a8\u5f15\u64ce\u5404\u6709\u4e0d\u540c\uff0cInnoDB\u901a\u8fc7\u5728Range\u7684\u4e0a\u9650\u548c\u4e0b\u9650\u5904\u5404\u505a\u4e00\u6b21\u7edf\u8ba1\uff0c\u7136\u540e\u9884\u4f30\u6574\u4e2a\u533a\u95f4\u7684\u8bb0\u5f55\u6570\u3002<\/p>\n<p>\u6700\u540e\uff0c\u6700\u540e\uff0c\u6700\u540e\uff0cMySQL\u8bc4\u4f30\u6240\u6709\u7684Range\u3001\u5168\u8868\u626b\u63cf\u7684\u4ee3\u4ef7\uff0c\u6700\u540e\u9009\u51fa\u4ee3\u4ef7\u6700\u5c0fRange\u4f5c\u4e3a\u6267\u884c\u8ba1\u5212\u3002\uff08\u662f\u4e0d\u662f\u6700\u60f3\u770b\u8fd9\u90e8\u5206\uff0c\u5374\u4e00\u7b14\u5e26\u8fc7\u4e86\uff01\u4f1a\u6709\u7684:)\uff09<\/p>\n<h3>\u53c2\u8003<\/h3>\n<p>1. <a href=\"http:\/\/hedengcheng.com\/?p=372\" target=\"_blank\">MySQL\u67e5\u8be2\u4f18\u5316\u6d45\u6790<\/a> by \u4f55\u767b\u6210<\/p>\n<p>2. <a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/optimization-internals.html\" target=\"_blank\">Internal Details of MySQL Optimizations<\/a> @ MySQL Manual<\/p>\n<p>3. <a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/mrr-optimization.html\" target=\"_blank\">Multi-Range Read Optimization<\/a> @ MySQL Manual<\/p>\n<p>4. <a href=\"https:\/\/kb.askmonty.org\/en\/multi-range-read-optimization\/\" target=\"_blank\">Multi Range Read optimization<\/a> @ Knowledge Base of  MariaDB<\/p>\n<p>5. <a href=\"https:\/\/kb.askmonty.org\/en\/block-based-join-algorithms\/#batch-key-access-join\" target=\"_blank\">Block-Based Join Algorithms<\/a> @ Knowledge Base of  MariaD<\/p>\n<p>6. <a href=\"http:\/\/assets.en.oreilly.com\/1\/event\/21\/Understanding%20and%20Control%20of%20MySQL%20Query%20Optimizer_%20Traditional%20and%20Novel%20Tools%20and%20Techniques%20Presentation.pdf\" target=\"_blank\">Understanding and control of MySQL Query Optimizer<\/a> by Sergey Petrunya@2009<\/p>\n<p>7. <a href=\"http:\/\/s.petrunia.net\/files\/MRR-Interface-Sorrento2006.pdf\" target=\"_blank\">Multi Range Read interface<\/a> By Sergey Petrunia<\/p>\n<p>8. <a href=\"http:\/\/dev.mysql.com\/doc\/internals\/en\/optimizer-primary-optimizations.html#optimizer-range-join-type\" target=\"_blank\">The range Join Type<\/a> @MySQL Internal<\/p>\n<p>9. <a href=\"http:\/\/downloads.mysql.com\/forge\/slides\/InteractionBetweenOptimizerAndStorageEngine-final.pdf\" target=\"_blank\">Interaction Between Optimizer and Storage Engine<\/a><\/p>\n<p>10. MySQL Source Code<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u767b\u535a\u5f00\u4e86\u4e00\u4e2a\u5934\uff0c\u5e0c\u671b\u80fd\u591f\u5f80\u524d\u8d70\u4e00\u70b9\u3002\u6cdb\u8bfb\u4e86\u6574\u4e2aMySQL Range\u4f18\u5316\u7684\u76f8\u5173\u4ee3\u7801\uff0c\u8fd9\u91cc\u5c06\u603b\u7ed3Range\u4f18\u5316\u76f8\u5173\u7684\u6570\u636e\u7ed3\u6784\u3002\u672c\u6587\u4e0d\u662f\u4ece\u5b8f\u89c2(High Level)\u89d2\u5ea6\u4ecb\u7ecdRange\u4f18\u5316\u76f8\u5173\u5185\u5bb9\uff0c\u5982\u679c\u770b\u5ba2\u5bf9\u6b64\u611f\u5174\u8da3\uff0c\u5efa\u8bae\u7ed5\u8fc7\u672c\u6587\uff0c\u76f4\u63a5\u9605\u8bfb\u53c2\u8003\u6587\u732e\uff0c\u76f8\u4fe1\u4f1a\u6709\u6536\u83b7\u3002 \u5df2\u7ecf\u8fde\u7eed\u5199\u4e86\u51e0\u7bc7\u5173\u4e8e\u4f18\u5316\u5668\u76f8\u5173\u7684\u6570\u636e\u7ed3\u6784\u7684\u535a\u5ba2\u4e86\uff0c\u53ea\u662f\u5e0c\u671b\u9700\u8981\u7684\u4eba\u662f\u5728\u9700\u8981\u7684\u65f6\u5019\u80fd\u591f\u770b\u5230\u3002 1. \u80cc\u666f\u77e5\u8bc6 \u5728\u5f00\u59cb\u4ecb\u7ecdRange\u7684\u4e3b\u8981\u6570\u636e\u7ed3\u6784\u4e4b\u524d\uff0c\u6211\u4eec\u5148\u770bRange\u4f18\u5316\u7684\u4e00\u4e9b\u6982\u5ff5\u548c\u80cc\u666f\u3002\u4f9d\u65e7\u5efa\u8bae\u5148\u9605\u8bfb\u53c2\u8003\u6587\u4ef6\u7684[1-8]\uff0cSergey Petrunya\u5199\u7684PPT\u548c\u6587\u6863\u8d28\u91cf\u90fd\u5f88\u9ad8\uff0c\u5f88\u591a\u56fe\u793a\uff0c\u975e\u5e38\u76f4\u89c2\u7684\u5c55\u793a\u4e86\u539f\u7406\u3002 (1) \u4ec0\u4e48\u662fRange\u6761\u4ef6? \u53c2\u8003Range Optimization@MySQL Manual \u5355\u5217Range\u548c\u591a\u5217Range (2) \u7ed9\u5b9a\u4e00\u4e2aKEY(key1)\u5bf9\u5e94\u7684WHERE\u6761\u4ef6\uff0c\u5982\u4f55\u5c06\u5176\u8f6c\u5316\u6210\u4e00\u4e2aRange\uff0c\u4e0b\u9762\u662f&#8221;\u7b80\u8ff0&#8221;\uff0c\u8be6\u7ec6\u53c2\u8003\u5355\u5217Range\uff1a SELECT * FROM t1 WHERE (key1 < 'abc' AND (key1 LIKE 'abcde%' OR key1 LIKE '%b')) OR (key1 < 'bar' AND nonkey = 4) OR (key1 < 'uux' AND key1 > &#8216;z&#8217;); 1.1 \u66ff\u6362\u6240\u6709\u975eRANGE\u67e5\u8be2\u4e3aTRUE<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","inline_featured_image":false,"_tocer_settings":[],"footnotes":""},"categories":[6,4],"tags":[101,118,58],"class_list":["post-4026","post","type-post","status-publish","format-standard","hentry","category-mysql","category-code-detail","tag-index","tag-mysql","tag-source-code"],"_links":{"self":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/4026","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/comments?post=4026"}],"version-history":[{"count":53,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/4026\/revisions"}],"predecessor-version":[{"id":4199,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/4026\/revisions\/4199"}],"wp:attachment":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/media?parent=4026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/categories?post=4026"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/tags?post=4026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}