{"id":2316,"date":"2026-10-07T16:06:49","date_gmt":"2026-10-07T08:06:49","guid":{"rendered":"http:\/\/www.spiceandwolf.com.cn\/?p=2316"},"modified":"2026-10-20T16:41:43","modified_gmt":"2026-10-20T08:41:43","slug":"mysql-book-zy-10","status":"publish","type":"post","link":"http:\/\/www.spiceandwolf.com.cn\/index.php\/mysql-book-zy-10\/","title":{"rendered":"\u300aMySQL\u600e\u8fd0&#8230;\u300b\u7b2c\u5341\u7ae0 \u5355\u8868\u8bbf\u95ee\u65b9\u6cd5\uff08\u6458\u8981\uff09"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u8bbf\u95ee\u65b9\u6cd5\uff08\u5355\u8868\u67e5\u8be2\uff09<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5927\u81f4\u5206\u4e3a\u4e24\u79cd<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5168\u8868\u626b\u63cf\u3002all<\/li>\n\n\n\n<li>\u4f7f\u7528\u7d22\u5f15\u8fdb\u884c\u67e5\u8be2\n<ul class=\"wp-block-list\">\n<li>const<\/li>\n\n\n\n<li>ref<\/li>\n\n\n\n<li>ref_or_null<\/li>\n\n\n\n<li>range<\/li>\n\n\n\n<li>index<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u53c2\u8003\u8868\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE TABLE single_table (\nid INT NOT NULL AUTO_INCREMENT,\nkey1 VARCHAR(100),\nkey2 INT,\nkey3 VARCHAR(100),\nkey_part1 VARCHAR(100),\nkey_part2 VARCHAR(100),\nkey_part3 VARCHAR(100),\ncommon_field VARCHAR(100),\nPRIMARY KEY (id),\nKEY idx_key1 (key1),\nUNIQUE KEY idx_key2 (key2),\nKEY idx_key3 (key3),\nKEY idx_key_part(key_part1, key_part2, key_part3)\n) Engine=InnoDB CHARSET=utf8;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">const<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u9488\u5bf9\u4e3b\u952e\u6216\u552f\u4e00\u4e8c\u7ea7\u7d22\u5f15\u7684\u7b49\u503c\u67e5\u8be2\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u672c\u8d28\u4e3a\u4f7f\u7528\u805a\u7c07\u7d22\u5f15\u67e5\u627e<strong><em>\u5355\u6761\u8bb0\u5f55<\/em><\/strong>\u6216\u4f7f\u7528\u4e8c\u7ea7\u7d22\u5f15\u67e5\u627e\u5230<strong><em>\u5355\u6761\u8bb0\u5f55<\/em><\/strong>\u7136\u540e\u518d\u5728\u805a\u7c07\u7d22\u5f15\u4e2d\u56de\u8868\u67e5\u8be2<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u56e0\u4e3a\u552f\u4e00\u4e8c\u7ea7\u7d22\u5f15\u7684NULL\u503c\u884c\u6570\u53ef\u80fd\u4e3a\u591a\u6761\uff0c\u6240\u4ee5\u4ee5\u4e0b\u8bed\u53e5\u4e0d\u53ef\u4ee5\u4f7f\u7528const\u65b9\u6cd5\u6765\u6267\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE key2 IS NULL;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">ref<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u9488\u5bf9\u666e\u901a\u4e8c\u7ea7\u7d22\u5f15\u7684\u7b49\u503c\u67e5\u8be2<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u672c\u8d28\u4e3a\u5148\u4f7f\u7528\u4e8c\u7ea7\u7d22\u5f15\u67e5\u627e\u5230\u5339\u914d\u7684id\u503c\uff0c\u7136\u540e\u518d\u5728\u805a\u7c07\u7d22\u5f15\u4e2d\u56de\u8868\u67e5\u8be2\u5b8c\u6574\u7684\u7528\u6237\u8bb0\u5f55\u3002\u4f46\u662f\u4e8c\u7ea7\u7d22\u5f15\u5339\u914d\u5230\u7684id\u503c\u53ef\u80fd\u4e3a\u591a\u6761\uff0c\u6240\u4ee5\u7d22\u5f15\u4e8c\u7ea7\u7d22\u5f15\u6267\u884c\u67e5\u8be2\u7684\u4ee3\u4ef7\u53d6\u51b3\u4e8e\u7b49\u503c\u5339\u914d\u5230\u7684\u4e8c\u7ea7\u7d22\u5f15\u8bb0\u5f55\u6761\u6570\uff0c\u5339\u914d\u8bb0\u5f55\u8f83\u5c11\u7684\u60c5\u51b5\u4e0b\u56de\u8868\u7684\u4ee3\u4ef7\u53ef\u80fd\u5c0f\u4e8e\u5168\u8868\u626b\u63cf\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6ce8\u610f\u4e00\u4e0b\u4e24\u79cd\u60c5\u51b5\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e8c\u7ea7\u7d22\u5f15\u5217\u503c\u4e3aNULL\u3002\u4e0d\u8bba\u662f\u666e\u901a\u7684\u4e8c\u7ea7\u7d22\u5f15\uff0c\u8fd8\u662f\u552f\u4e00\u4e8c\u7ea7\u7d22\u5f15\uff0c\u4e3a\u5217\u503c\u4e3aNULL\u90fd\u53ef\u80fd\u67e5\u5904\u591a\u6761\uff0c\u6240\u4ee5\u4f7f\u7528\u7684\u662fref\uff0c\u800c\u4e0d\u662fconst<\/li>\n\n\n\n<li>\u6700\u5de6\u8fb9\u7684\u8fde\u7eed\u7d22\u5f15\u5217\u662f\u4e0e\u5e38\u6570\u7684\u7b49\u503c\u6bd4\u8f83\u5c31\u53ef\u80fd\u91c7\u7528 ref<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE key_part1 = 'god like';\nSELECT * FROM single_table WHERE key_part1 = 'god like' AND key_part2 = 'legendary';\nSELECT * FROM single_table WHERE key_part1 = 'god like' AND key_part2 = 'legendary' AND key_part3 = 'penta kill';<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5982\u679c\u6700\u5de6\u8fb9\u7684\u8fde\u7eed\u7d22\u5f15\u5217\u5e76\u4e0d\u5168\u90e8\u662f\u7b49\u503c\u6bd4\u8f83\u7684\u8bdd\uff0c\u5b83\u7684\u8bbf\u95ee\u65b9\u6cd5\u5c31\u4e0d\u80fd\u79f0\u4e3a ref \u4e86<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE key_part1 = 'god like' AND key_part2 &gt; 'legendary';<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">ref_or_null<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u9488\u5bf9\u666e\u901a\u4e8c\u7ea7\u7d22\u5f15\u7684\u7b49\u503c\u6216null\u503c\u67e5\u8be2\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_demo WHERE key1 = 'abc' OR key1 IS NULL;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8ddfref\u7c7b\u4f3c\uff0c\u5c31\u662f\u4e8c\u7ea7\u7d22\u5f15\u67e5\u627e\u65f6\u4e0eis null\u7684\u7ed3\u679c\u96c6\u505a\u5e76\u96c6\uff0c\u7b26\u5408\u6761\u4ef6\u7684\u7136\u540e\u8fdb\u884c\u56de\u8868\u67e5\u8be2<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">range<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u9488\u5bf9\u805a\u7c07\u7d22\u5f15\u6216\u8005\u4e8c\u7ea7\u7d22\u5f15\u8fdb\u884c\u8303\u56f4\u67e5\u8be2\uff08\u8303\u56f4\u53ef\u4ee5\u662f\u5355\u4e2a\u4e5f\u53ef\u4ee5\u662f\u591a\u4e2a\uff09\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE key2 IN (1438, 6328) OR (key2 &gt;= 38 AND key2 &lt;= 79);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">index<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u904d\u5386\u4e8c\u7ea7\u7d22\u5f15\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u96c6\u7684\u67e5\u8be2\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT key_part1, key_part2, key_part3 FROM single_table WHERE key_part2 = 'abc';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u56e0\u4e3a\u4e0d\u7b26\u5408\u6700\u5de6\u5339\u914d\u539f\u5219\uff0c\u6240\u4ee5\u65e0\u6cd5\u4f7f\u7528ref\u6216\u8005range\u7684\u67e5\u8be2\u65b9\u5f0f\uff0c\u4f46\u662f\u7ed3\u679c\u5217\u5168\u5305\u542b\u5728idx_key_part\uff0c\u7d22\u5f15\u4e2d\uff0c\u6240\u4ee5\u904d\u5386idx_key_part\u7684\u4e8c\u7ea7\u7d22\u5f15\u5c31\u80fd\u5f97\u5230\u6700\u7ec8\u7ed3\u679c\u96c6\uff0c\u4e14\u8fd9\u79cd\u67e5\u8be2\u7684\u6210\u672c\u8981\u6bd4\u904d\u5386\u805a\u7c07\u7d22\u5f15\u7684\u8981\u4f4e\u5f88\u591a\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">all<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5168\u8868\u626b\u63cf\uff0c\u5bf9\u4e8e InnoDB \u8868\u6765\u8bf4\u4e5f\u5c31\u662f\u76f4\u63a5\u626b\u63cf\u805a\u7c07\u7d22\u5f15<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5355\u8868\u8bbf\u95ee\u6ce8\u610f\u4e8b\u9879<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e8c\u7ea7\u7d22\u5f15+\u56de\u8868<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e00\u4e2a\u67e5\u8be2\u4e3a\u4f8b\uff0c\u8bf4\u660e\u5728\u4e00\u822c\u573a\u666f\u4e0b\u53ea\u80fd\u5229\u7528\u5355\u4e2a\u4e8c\u7ea7\u7d22\u5f15\u6267\u884c\u67e5\u8be2\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE key1 = 'abc' AND key2 &gt; 1000;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u6709\u4e24\u4e2a\u67e5\u8be2\u6761\u4ef6\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>key1 = &#8216;abc&#8217;<\/li>\n\n\n\n<li>key2 &gt; 1000<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f18\u5316\u5668\u4f1a\u6839\u636e\u8868\u7684\u7edf\u8ba1\u6570\u636e\u5224\u65ad\u5230\u5e95\u4f7f\u7528\u54ea\u4e2a\u6761\u4ef6\u5728\u4e8c\u7ea7\u7d22\u5f15\u4e2d\u626b\u63cf\u7684\u884c\u6570\u4f1a\u66f4\u5c11\uff0c\u9009\u62e9\u66f4\u5c11\u7684\u90a3\u4e2a\u8fdb\u884c\u67e5\u8be2\uff0c\u7136\u540e\u5f97\u5230\u4e8c\u7ea7\u7d22\u5f15\u8bb0\u5f55\u7ed3\u679c\u96c6\uff0c\u6839\u636e\u7ed3\u679c\u96c6\u8fdb\u884c\u56de\u8868\u67e5\u8be2\u5f97\u5230\u5b8c\u6574\u7528\u6237\u8bb0\u5f55\uff0c\u6700\u540e\u6839\u636e\u5176\u4f59where\u6761\u4ef6\u8fdb\u884c\u8fc7\u6ee4\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">range\u8bbf\u95ee\u65b9\u5f0f\u7684\u6267\u884c\u89c4\u5219<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5176\u5b9e\u5bf9\u4e8e B+ \u6811\u7d22\u5f15\u6765\u8bf4\uff0c\u53ea\u8981\u7d22\u5f15\u5217\u548c\u5e38\u6570\u4f7f\u7528=\u3001 &lt;=&gt; \u3001 IN \u3001 NOT IN \u3001 IS NULL \u3001 IS NOT NULL\u3001&gt; \u3001 &lt; \u3001 &gt;= \u3001 &lt;= \u3001 BETWEEN \u3001 != \uff08\u4e0d\u7b49\u4e8e\u4e5f\u53ef\u4ee5\u5199\u6210 &lt;&gt; \uff09\u6216\u8005 LIKE \u64cd\u4f5c\u7b26\u8fde\u63a5\u8d77\u6765\uff0c\u5c31\u53ef\u4ee5\u4ea7\u751f\u4e00\u4e2a\u6240\u8c13\u7684\u533a\u95f4\u3002\u5f53\u6211\u4eec\u60f3\u4f7f\u7528 range \u8bbf\u95ee\u65b9\u6cd5\u6765\u6267\u884c\u4e00\u4e2a\u67e5\u8be2\u8bed\u53e5\u65f6\uff0c\u91cd\u70b9\u5c31\u662f\u627e\u51fa\u8be5\u67e5\u8be2\u53ef\u7528\u7684\u7d22\u5f15\u4ee5\u53ca\u8fd9\u4e9b\u7d22\u5f15\u5bf9\u5e94\u7684\u8303\u56f4\u533a\u95f4<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">\u6240\u6709\u641c\u7d22\u6761\u4ef6\u90fd\u53ef\u4ee5\u4f7f\u7528\u67d0\u4e2a\u7d22\u5f15\u7684\u60c5\u51b5<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE key2 &gt; 100 AND key2 &gt; 200;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u53d6\u4ea4\u96c6\uff0c\u5c31\u662f(200,+\u221e)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE key2 &gt; 100 OR key2 &gt; 200;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u53d6\u5e76\u96c6\uff0c\u5c31\u662f(100,+\u221e)<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">\u6709\u7684\u641c\u7d22\u6761\u4ef6\u65e0\u6cd5\u4f7f\u7528\u7d22\u5f15\u7684\u60c5\u51b5<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE key2 &gt; 100 AND common_field = 'abc';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u67e5\u8be2\u4e2d\u80fd\u5229\u7528\u7684\u7d22\u5f15\u53ea\u6709idx_key2\uff0c\u800cidx_key2\u7d22\u5f15\u53c8\u4e0d\u5305\u542bcommon_field\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u6240\u4ee5\u8fd9\u4e2a\u6761\u4ef6\u5728\u56de\u8868\u83b7\u53d6\u4e86\u5b8c\u6574\u7684\u7528\u6237\u8bb0\u5f55\u540e\u624d\u80fd\u4f7f\u7528\u3002\u5728\u4e3a\u67d0\u4e2a\u7d22\u5f15\u786e\u5b9a\u8303\u56f4\u533a\u95f4\u7684\u65f6\u5019\u53ea\u9700\u8981\u628a\u7528\u4e0d\u5230\u76f8\u5173\u7d22\u5f15\u7684\u641c\u7d22\u6761\u4ef6\u66ff\u6362\u4e3a TRUE \u5c31\u597d\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u628a\u4e0a\u8fb9\u7684\u67e5\u8be2\u4e2d\u7528\u4e0d\u5230 idx_key2 \u7684\u641c\u7d22\u6761\u4ef6\u66ff\u6362\u540e\u5c31\u662f\u8fd9\u6837\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE key2 &gt; 100 AND TRUE;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5316\u7b80\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE key2 &gt; 100 AND TRUE;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e5f\u5c31\u662f\u8bf4\u6700\u4e0a\u8fb9\u90a3\u4e2a\u67e5\u8be2\u4f7f\u7528 idx_key2 \u7684\u8303\u56f4\u533a\u95f4\u5c31\u662f\uff1a (100, +\u221e)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u628a\u67e5\u8be2\u8bed\u53e5\u4e2d\u7684and\u6539\u4e3aor\u5462\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE key2 &gt; 100 OR common_field = 'abc';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u628a\u4f7f\u7528\u4e0d\u5230 idx_key2 \u7d22\u5f15\u7684\u641c\u7d22\u6761\u4ef6\u66ff\u6362\u4e3a TRUE \uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE key2 &gt; 100 OR TRUE;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5316\u7b80\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE TRUE;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u5f3a\u5236\u4f7f\u7528idx_key2\u7d22\u5f15\u8fdb\u884c\u67e5\u8be2\uff0c\u5219\u9700\u8981\u57fa\u4e8e\u4e8c\u7ea7\u7d22\u5f15\u7684\u6240\u6709\u6570\u636e\u8fdb\u884c\u56de\u8868\u67e5\u8be2\u3002\u5c31\u662f\u8bf4\u4e00\u4e2a\u4f7f\u7528\u5230\u7d22\u5f15\u7684\u641c\u7d22\u6761\u4ef6\u548c\u6ca1\u6709\u4f7f\u7528\u8be5\u7d22\u5f15\u7684\u641c\u7d22\u6761\u4ef6\u4f7f\u7528 OR \u8fde\u63a5\u8d77\u6765\u540e\u662f\u65e0\u6cd5\u4f7f\u7528\u8be5\u7d22\u5f15\u7684\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">\u590d\u6742\u641c\u7d22\u6761\u4ef6\u4e0b\u627e\u51fa\u8303\u56f4\u5339\u914d\u7684\u533a\u95f4<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">\u590d\u6742\u7684\u8303\u56f4\u5339\u914d\u533a\u95f4\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u65b9\u5f0f\u8fdb\u884c\u5206\u6790\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u9996\u5148\u67e5\u770b WHERE \u5b50\u53e5\u4e2d\u7684\u641c\u7d22\u6761\u4ef6\u90fd\u6d89\u53ca\u5230\u4e86\u54ea\u4e9b\u5217\uff0c\u54ea\u4e9b\u5217\u53ef\u80fd\u4f7f\u7528\u5230\u7d22\u5f15<\/li>\n\n\n\n<li>\u5bf9\u4e8e\u90a3\u4e9b\u53ef\u80fd\u7528\u5230\u7684\u7d22\u5f15\uff0c\u5206\u6790\u5b83\u4eec\u7684\u8303\u56f4\u533a\u95f4\u3002\u5728\u57fa\u4e8e\u67d0\u4e2a\u7d22\u5f15\u8fdb\u884c\u5206\u6790\u65f6\uff0c\u9700\u8981\u628a\u90a3\u4e9b\u7528\u4e0d\u5230\u8be5\u7d22\u5f15\u7684\u641c\u7d22\u6761\u4ef6\u6682\u65f6\u79fb\u9664\u6389\uff0c\u79fb\u9664\u65b9\u6cd5\u4e5f\u7b80\u5355\uff0c\u76f4\u63a5\u628a\u5b83\u4eec\u66ff\u6362\u4e3a TRUE<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE\n(key1 &gt; 'xyz' AND key2 = 748 ) OR\n(key1 &lt; 'abc' AND key1 &gt; 'lmn') OR\n(key1 LIKE '%suf' AND key1 &gt; 'zzz' AND (key2 &lt; 8000 OR common_field = 'abc')) ;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5047\u5982\u6211\u4eec\u4f7f\u7528idx_key1\u6267\u884c\u67e5\u8be2<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u9700\u8981\u628a\u90a3\u4e9b\u7528\u4e0d\u5230\u8be5\u7d22\u5f15\u7684\u641c\u7d22\u6761\u4ef6\u6682\u65f6\u79fb\u9664\u6389\uff0c\u5373\u76f4\u63a5\u66ff\u6362\u4e3aTURE\uff0c\u66ff\u6362\u540e\u7684\u641c\u7d22\u6761\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(key1 &gt; 'xyz' AND TRUE ) OR\n(key1 &lt; 'abc' AND key1 &gt; 'lmn') OR\n(TRUE AND key1 &gt; 'zzz' AND (TRUE OR TRUE))<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5316\u7b80\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(key1 &gt; 'xyz') OR\n(key1 &lt; 'abc' AND key1 &gt; 'lmn') OR\n(key1 &gt; 'zzz')<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u66ff\u6362\u6389\u6c38\u8fdc\u4e3a TRUE \u6216 FALSE \u7684\u6761\u4ef6\uff0c\u56e0\u4e3a\u7b26\u5408 key1 &lt; &#8216;abc&#8217; AND key1 &gt; &#8216;lmn&#8217; \u6c38\u8fdc\u4e3a FALSE\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(key1 &gt; 'xyz') OR (key1 &gt; 'zzz')<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e24\u4e2a\u533a\u95f4\u53d6\u5e76\u96c6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>key1 &gt; xyz<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6240\u4ee5\u5f53\u4e0a\u8ff0\u67e5\u8be2\u57fa\u4e8eidx_key1\u7d22\u5f15\u7528range\u7684\u8bbf\u95ee\u65b9\u5f0f\u8fdb\u884c\u67e5\u8be2\u65f6\uff0c\u4f1a\u5148\u628a\u6ee1\u8db3&nbsp;key1 &gt; xyz&nbsp;\u7684\u4e8c\u7ea7\u7d22\u5f15\u8bb0\u5f55\u90fd\u53d6\u51fa\u6765\uff0c\u7136\u540e\u62ff\u7740\u8fd9\u4e9b\u8bb0\u5f55\u7684id\u518d\u8fdb\u884c\u56de\u8868\uff0c\u5f97\u5230\u5b8c\u6574\u7684\u7528\u6237\u8bb0\u5f55\u4e4b\u540e\u518d\u4f7f\u7528\u5176\u4ed6\u7684\u641c\u7d22\u6761\u4ef6\u8fdb\u884c\u8fc7\u6ee4<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5047\u5982\u6211\u4eec\u4f7f\u7528idx_key2\u6267\u884c\u67e5\u8be2<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u9700\u8981\u628a\u90a3\u4e9b\u7528\u4e0d\u5230\u8be5\u7d22\u5f15\u7684\u641c\u7d22\u6761\u4ef6\u6682\u65f6\u79fb\u9664\u6389\uff0c\u5373\u76f4\u63a5\u66ff\u6362\u4e3aTURE\uff0c\u66ff\u6362\u540e\u7684\u641c\u7d22\u6761\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(TRUE AND key2 = 748 ) OR\n(TRUE AND TRUE) OR\n(TRUE AND TRUE AND (key2 &lt; 8000 OR TRUE))<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5316\u7b80\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>key2 = 748 OR TRUE<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u540e\u7ed3\u679c\u5c31\u662fTRUE\u3002\u8fd9\u4e2a\u7ed3\u679c\u4e5f\u5c31\u610f\u5473\u7740\u5982\u679c\u6211\u4eec\u8981\u4f7f\u7528 idx_key2 \u7d22\u5f15\u6267\u884c\u67e5\u8be2\u8bed\u53e5\u7684\u8bdd\uff0c\u9700\u8981\u626b\u63cf idx_key2 \u4e8c\u7ea7\u7d22\u5f15\u7684\u6240\u6709\u8bb0\u5f55\uff0c\u7136\u540e\u518d\u56de\u8868\uff0c\u8fd9\u4e0d\u662f\u5f97\u4e0d\u507f\u5931\u4e48\uff0c\u6240\u4ee5\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u4f7f\u7528 idx_key2 \u7d22\u5f15\u7684\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7d22\u5f15\u5408\u5e76<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL \u5728\u4e00\u822c\u60c5\u51b5\u4e0b\u6267\u884c\u4e00\u4e2a\u67e5\u8be2\u65f6\u6700\u591a\u53ea\u4f1a\u7528\u5230\u5355\u4e2a\u4e8c\u7ea7\u7d22\u5f15\uff0c\u4f46\u4e0d\u662f\u8fd8\u6709\u7279\u6b8a\u60c5\u51b5\u4e48\uff0c\u5728\u8fd9\u4e9b\u7279\u6b8a\u60c5\u51b5\u4e0b\u4e5f\u53ef\u80fd\u5728\u4e00\u4e2a\u67e5\u8be2\u4e2d\u4f7f\u7528\u5230\u591a\u4e2a\u4e8c\u7ea7\u7d22\u5f15\uff0c\u8bbe\u8ba1 MySQL \u7684\u5927\u53d4\u628a\u8fd9\u79cd\u4f7f\u7528\u5230\u591a\u4e2a\u7d22\u5f15\u6765\u5b8c\u6210\u4e00\u6b21\u67e5\u8be2\u7684\u6267\u884c\u65b9\u6cd5\u79f0\u4e4b\u4e3a\uff1a index merge \uff0c\u5177\u4f53\u7684\u7d22\u5f15\u5408\u5e76\u7b97\u6cd5\u6709\u4e0b\u8fb9\u4e09\u79cd<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Intersection<\/strong>\u5408\u5e76<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">\u67d0\u4e2a\u67e5\u8be2\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a\u4e8c\u7ea7\u7d22\u5f15\uff0c\u5c06\u4ece\u591a\u4e2a\u4e8c\u7ea7\u7d22\u5f15\u4e2d\u67e5\u8be2\u5230\u7684\u7ed3\u679c\u53d6\u4ea4\u96c6\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u5c31\u662f<strong>Intersection<\/strong>\u5408\u5e76\u3002\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE key1 = 'a' AND key3 = 'b';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u8fd9\u4e2a\u67e5\u8be2\u4f7f\u7528 Intersection \u5408\u5e76\u7684\u65b9\u5f0f\u6267\u884c\u7684\u8bdd\uff0c\u90a3\u8fd9\u4e2a\u8fc7\u7a0b\u5c31\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4ece idx_key1 \u4e8c\u7ea7\u7d22\u5f15\u5bf9\u5e94\u7684 B+ \u6811\u4e2d\u53d6\u51fa key1 = &#8216;a&#8217; \u7684\u76f8\u5173\u8bb0\u5f55\u3002<\/li>\n\n\n\n<li>\u4ece idx_key3 \u4e8c\u7ea7\u7d22\u5f15\u5bf9\u5e94\u7684 B+ \u6811\u4e2d\u53d6\u51fa key3 = &#8216;b&#8217; \u7684\u76f8\u5173\u8bb0\u5f55\u3002<\/li>\n\n\n\n<li>\u4e8c\u7ea7\u7d22\u5f15\u7684\u8bb0\u5f55\u90fd\u662f\u7531 \u7d22\u5f15\u5217 + \u4e3b\u952e \u6784\u6210\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u8ba1\u7b97\u51fa\u8fd9\u4e24\u4e2a\u7ed3\u679c\u96c6\u4e2d id \u503c\u7684\u4ea4\u96c6\u3002<\/li>\n\n\n\n<li>\u6309\u7167\u4e0a\u4e00\u6b65\u751f\u6210\u7684 id \u503c\u5217\u8868\u8fdb\u884c\u56de\u8868\u64cd\u4f5c\uff0c\u4e5f\u5c31\u662f\u4ece\u805a\u7c07\u7d22\u5f15\u4e2d\u628a\u6307\u5b9a id \u503c\u7684\u5b8c\u6574\u7528\u6237\u8bb0\u5f55\u53d6\u51fa\u6765\uff0c\u8fd4\u56de\u7ed9\u7528\u6237\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u91cc\u8fd8\u6709\u53e6\u4e00\u79cd\u67e5\u8be2\u65b9\u5f0f\uff0c\u5373\u57fa\u4e8eidx_key1\u6216idx_key3\u67e5\u8be2\u4e8c\u7ea7\u7d22\u5f15\uff0c\u57fa\u4e8e\u4e8c\u7ea7\u7d22\u5f15\u7684\u7ed3\u679c\u96c6\u8fdb\u884c\u56de\u8868\u64cd\u4f5c\uff0c\u7136\u540e\u5728\u7528\u5176\u4f59\u7684\u641c\u7d22\u6761\u4ef6\u8fdb\u884c\u8fc7\u6ee4\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e24\u79cd\u67e5\u8be2\u65b9\u5f0f\u7684\u5dee\u522b\u5728\u4e8e\u524d\u8005\u8fdb\u884c\u4e86\u4e24\u6b21\u4e8c\u7ea7\u7d22\u5f15\u67e5\u8be2\u5e76\u56de\u8868\u524d\u8fdb\u884c\u4e86\u4ea4\u96c6\u64cd\u4f5c\uff0c\u8fd9\u6837\u80fd\u8ba9\u9700\u8981\u56de\u8868\u7684\u4e8c\u7ea7\u7d22\u5f15\u7ed3\u679c\u96c6\u66f4\u5c0f\uff0c\u6240\u4ee5\u6bd4\u8f83\u4e24\u8005\u6267\u884c\u6027\u80fd\u7684\u5173\u952e\u5728\u4e8e\uff1a\u5bf9\u6bd4\u4e8e\u524d\u8005\u66f4\u5c0f\u7684\u4e8c\u7ea7\u7d22\u5f15\u7ed3\u679c\u96c6\uff0c\u540e\u8005\u56de\u8868\u9020\u6210\u7684\u989d\u5916\u6027\u80fd\u635f\u8017\u80fd\u5426\u6bd4\u8bbf\u95ee\u591a\u4e2a\u4e8c\u7ea7\u7d22\u5f15\u5e26\u6765\u7684\u6027\u80fd\u635f\u8017\u66f4\u9ad8\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL\u53ef\u80fd\u4f1a\u4f7f\u7528\u5230 Intersection \u7d22\u5f15\u5408\u5e76\u7684\u573a\u666f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e8c\u7ea7\u7d22\u5f15\u5217\u662f\u7b49\u503c\u5339\u914d\u7684\u60c5\u51b5\uff0c\u5bf9\u4e8e\u8054\u5408\u7d22\u5f15\u6765\u8bf4\uff0c\u5728\u8054\u5408\u7d22\u5f15\u4e2d\u7684\u6bcf\u4e2a\u5217\u90fd\u5fc5\u987b\u7b49\u503c\u5339\u914d\uff0c\u4e0d\u80fd\u51fa\u73b0\u53ea\u51fa\u73b0\u5339\u914d\u90e8\u5206\u5217\u7684\u60c5\u51b5\u3002\u4f8b\u5982\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code># \u53ef\u4ee5\u4f7f\u7528\nSELECT * FROM single_table WHERE key1 = 'a' AND key_part1 = 'a' AND key_part2 = 'b'\nAND key_part3 = 'c';\n\n# \u4e0d\u80fd\u4f7f\u7528\nSELECT * FROM single_table WHERE key1 &gt; 'a' AND key_part1 = 'a' AND key_part2 = 'b' AND key_part3 = 'c'; # \u56e0\u4e3akey1\u8fdb\u884c\u4e86\u8303\u56f4\u5339\u914d\nSELECT * FROM single_table WHERE key1 = 'a' AND key_part1 = 'a'; # \u56e0\u4e3a\u53ea\u7528\u5230\u4e86\u8054\u5408\u7d22\u5f15idx_key_part\u4e2d\u7684key_part1<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e3b\u952e\u5217\u53ef\u4ee5\u662f\u8303\u56f4\u5339\u914d\u3002\u4f8b\u5982\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE id &gt; 100 AND key1 = 'a';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u56e0\u4e3aid &gt; 100\u5b8c\u5168\u53ef\u4ee5\u770b\u4f5c\u662f\u4e00\u4e2a\u4e8c\u7ea7\u7d22\u5f15\u5f97\u5230\u7684\u7ed3\u679c\u96c6\uff0c\u4e14\u8fd9\u4e2a\u7ed3\u679c\u96c6\u662f\u57fa\u4e8e\u4e3b\u952eid\u6392\u5e8f\u7684\uff0c\u6240\u4ee5\u505a\u5e76\u96c6\u7684\u65f6\u5019\u4e0d\u9700\u8981\u505a\u989d\u5916\u7684\u6392\u5e8f\u64cd\u4f5c\uff0c\u8ddf\u4e24\u4e2a\u4e8c\u7ea7\u7d22\u5f15\u7ed3\u679c\u96c6\u505a\u5e76\u96c6\u7c7b\u4f3c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f53\u7136\uff0c\u4e0a\u8fb9\u8bf4\u7684 \u60c5\u51b5\u4e00 \u548c \u60c5\u51b5\u4e8c \u53ea\u662f\u53d1\u751f Intersection \u7d22\u5f15\u5408\u5e76\u7684\u5fc5\u8981\u6761\u4ef6\uff0c\u4e0d\u662f\u5145\u5206\u6761\u4ef6\u3002\u4e5f\u5c31\u662f\u8bf4\u5373\u4f7f\u60c5\u51b5\u4e00\u3001\u60c5\u51b5\u4e8c\u6210\u7acb\uff0c\u4e5f\u4e0d\u4e00\u5b9a\u53d1\u751f Intersection \u7d22\u5f15\u5408\u5e76\uff0c\u8fd9\u5f97\u770b\u4f18\u5316\u5668\u7684\u5fc3\u60c5\u3002\u4f18\u5316\u5668\u53ea\u6709\u5728\u5355\u72ec\u6839\u636e\u641c\u7d22\u6761\u4ef6\u4ece\u67d0\u4e2a\u4e8c\u7ea7\u7d22\u5f15\u4e2d\u83b7\u53d6\u7684\u8bb0\u5f55\u6570\u592a\u591a\uff0c\u5bfc\u81f4\u56de\u8868\u5f00\u9500\u592a\u5927\uff0c\u800c\u901a\u8fc7 Intersection \u7d22\u5f15\u5408\u5e76\u540e\u9700\u8981\u56de\u8868\u7684\u8bb0\u5f55\u6570\u5927\u5927\u51cf\u5c11\u65f6\u624d\u4f1a\u4f7f\u7528 Intersection \u7d22\u5f15\u5408\u5e76\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Union<\/strong>\u5408\u5e76<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">\u67d0\u4e2a\u67e5\u8be2\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a\u4e8c\u7ea7\u7d22\u5f15\uff0c\u5e76\u5c06\u591a\u4e2a\u4e8c\u7ea7\u7d22\u5f15\u7ed3\u679c\u96c6\u53d6\u5e76\u96c6\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u5c31\u662fUnion\u5408\u5e76\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL\u53ef\u80fd\u4f1a\u4f7f\u7528\u5230 Union \u7d22\u5f15\u5408\u5e76\u7684\u573a\u666f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e8c\u7ea7\u7d22\u5f15\u5217\u662f\u7b49\u503c\u5339\u914d\u7684\u60c5\u51b5\uff0c\u5bf9\u4e8e\u8054\u5408\u7d22\u5f15\u6765\u8bf4\uff0c\u5728\u8054\u5408\u7d22\u5f15\u4e2d\u7684\u6bcf\u4e2a\u5217\u90fd\u5fc5\u987b\u7b49\u503c\u5339\u914d\uff0c\u4e0d\u80fd\u51fa\u73b0\u53ea\u51fa\u73b0\u5339\u914d\u90e8\u5206\u5217\u7684\u60c5\u51b5\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code># \u53ef\nSELECT * FROM single_table WHERE key1 = 'a' OR ( key_part1 = 'a' AND key_part2 = 'b'\nAND key_part3 = 'c');\n\n# \u4e0d\u53ef\nSELECT * FROM single_table WHERE key1 &gt; 'a' OR (key_part1 = 'a' AND key_part2 = 'b' AND key_part3 = 'c');\nSELECT * FROM single_table WHERE key1 = 'a' OR key_part1 = 'a';<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e3b\u952e\u5217\u53ef\u4ee5\u662f\u8303\u56f4\u5339\u914d<\/li>\n\n\n\n<li>\u4f7f\u7528 Intersection \u7d22\u5f15\u5408\u5e76\u7684\u641c\u7d22\u6761\u4ef6<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code># \u641c\u7d22\u6761\u4ef6\u7684\u67d0\u4e9b\u90e8\u5206\u4f7f\u7528 Intersection \u7d22\u5f15\u5408\u5e76\u7684\u65b9\u5f0f\u5f97\u5230\u7684\u4e3b\u952e\u96c6\u5408\u548c\u5176\u4ed6\u65b9\u5f0f\u5f97\u5230\u7684\u4e3b\u952e\u96c6\u5408\u53d6\u4ea4\u96c6\nSELECT * FROM single_table WHERE key_part1 = 'a' AND key_part2 = 'b' AND key_part3 =\n'c' OR (key1 = 'a' AND key3 = 'b');<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f53\u7136\uff0c\u67e5\u8be2\u6761\u4ef6\u7b26\u5408\u4e86\u8fd9\u4e9b\u60c5\u51b5\u4e5f\u4e0d\u4e00\u5b9a\u5c31\u4f1a\u91c7\u7528 Union \u7d22\u5f15\u5408\u5e76\uff0c\u4e5f\u5f97\u770b\u4f18\u5316\u5668\u7684\u5fc3\u60c5\u3002\u4f18\u5316\u5668\u53ea\u6709\u5728\u5355\u72ec\u6839\u636e\u641c\u7d22\u6761\u4ef6\u4ece\u67d0\u4e2a\u4e8c\u7ea7\u7d22\u5f15\u4e2d\u83b7\u53d6\u7684\u8bb0\u5f55\u6570\u6bd4\u8f83\u5c11\uff0c\u901a\u8fc7 Union \u7d22\u5f15\u5408\u5e76\u540e\u8fdb\u884c\u8bbf\u95ee\u7684\u4ee3\u4ef7\u6bd4\u5168\u8868\u626b\u63cf\u66f4\u5c0f\u65f6\u624d\u4f1a\u4f7f\u7528 Union \u7d22\u5f15\u5408\u5e76\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Sort-Union<\/strong>\u5408\u5e76<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Union \u7d22\u5f15\u5408\u5e76\u7684\u4f7f\u7528\u6761\u4ef6\u592a\u82db\u523b\uff0c\u5fc5\u987b\u4fdd\u8bc1\u5404\u4e2a\u4e8c\u7ea7\u7d22\u5f15\u5217\u5728\u8fdb\u884c\u7b49\u503c\u5339\u914d\u7684\u6761\u4ef6\u4e0b\u624d\u53ef\u80fd\u88ab\u7528\u5230\uff0c\u6bd4\u65b9\u8bf4\u4e0b\u8fb9\u8fd9\u4e2a\u67e5\u8be2\u5c31\u65e0\u6cd5\u4f7f\u7528\u5230 Union \u7d22\u5f15\u5408\u5e76\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM single_table WHERE key1 &lt; 'a' OR key3 &gt; 'z'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u662f\u56e0\u4e3a\u6839\u636e key1 &lt; &#8216;a&#8217; \u4ece idx_key1 \u7d22\u5f15\u4e2d\u83b7\u53d6\u7684\u4e8c\u7ea7\u7d22\u5f15\u8bb0\u5f55\u7684\u4e3b\u952e\u503c\u4e0d\u662f\u6392\u597d\u5e8f\u7684\uff0c\u6839\u636e key3 &gt;&#8217;z&#8217; \u4ece idx_key3 \u7d22\u5f15\u4e2d\u83b7\u53d6\u7684\u4e8c\u7ea7\u7d22\u5f15\u8bb0\u5f55\u7684\u4e3b\u952e\u503c\u4e5f\u4e0d\u662f\u6392\u597d\u5e8f\u7684\uff0c\u4f46\u662f key1 &lt; &#8216;a&#8217; \u548c key3 &gt; &#8216;z&#8217; \u8fd9\u4e24\u4e2a\u6761\u4ef6\u53c8\u7279\u522b\u8ba9\u6211\u4eec\u52a8\u5fc3\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u8fd9\u6837\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5148\u6839\u636e key1 &lt; &#8216;a&#8217; \u6761\u4ef6\u4ece idx_key1 \u4e8c\u7ea7\u7d22\u5f15\u603b\u83b7\u53d6\u8bb0\u5f55\uff0c\u5e76\u6309\u7167\u8bb0\u5f55\u7684\u4e3b\u952e\u503c\u8fdb\u884c\u6392\u5e8f<\/li>\n\n\n\n<li>\u518d\u6839\u636e key3 &gt; &#8216;z&#8217; \u6761\u4ef6\u4ece idx_key3 \u4e8c\u7ea7\u7d22\u5f15\u603b\u83b7\u53d6\u8bb0\u5f55\uff0c\u5e76\u6309\u7167\u8bb0\u5f55\u7684\u4e3b\u952e\u503c\u8fdb\u884c\u6392\u5e8f<\/li>\n\n\n\n<li>\u56e0\u4e3a\u4e0a\u8ff0\u7684\u4e24\u4e2a\u4e8c\u7ea7\u7d22\u5f15\u4e3b\u952e\u503c\u90fd\u662f\u6392\u597d\u5e8f\u7684\uff0c\u5269\u4e0b\u7684\u64cd\u4f5c\u548c Union \u7d22\u5f15\u5408\u5e76\u65b9\u5f0f\u5c31\u4e00\u6837\u4e86\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u628a\u4e0a\u8ff0\u8fd9\u79cd\u5148\u6309\u7167\u4e8c\u7ea7\u7d22\u5f15\u8bb0\u5f55\u7684\u4e3b\u952e\u503c\u8fdb\u884c\u6392\u5e8f\uff0c\u4e4b\u540e\u6309\u7167 Union \u7d22\u5f15\u5408\u5e76\u65b9\u5f0f\u6267\u884c\u7684\u65b9\u5f0f\u79f0\u4e4b\u4e3a Sort-Union \u7d22\u5f15\u5408\u5e76\uff0c\u5f88\u663e\u7136\uff0c\u8fd9\u79cd Sort-Union \u7d22\u5f15\u5408\u5e76\u6bd4\u5355\u7eaf\u7684 Union \u7d22\u5f15\u5408\u5e76\u591a\u4e86\u4e00\u6b65\u5bf9\u4e8c\u7ea7\u7d22\u5f15\u8bb0\u5f55\u7684\u4e3b\u952e\u503c\u6392\u5e8f\u7684\u8fc7\u7a0b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bbf\u95ee\u65b9\u6cd5\uff08\u5355\u8868\u67e5\u8be2\uff09 \u5927\u81f4\u5206\u4e3a\u4e24\u79cd \u53c2\u8003\u8868\uff1a const \u9488\u5bf9\u4e3b\u952e\u6216\u552f\u4e00\u4e8c\u7ea7\u7d22\u5f15\u7684\u7b49\u503c\u67e5\u8be2\u3002 \u672c\u8d28\u4e3a\u4f7f\u7528\u805a\u7c07\u7d22 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,88],"tags":[],"class_list":["post-2316","post","type-post","status-publish","format-standard","hentry","category-code","category-mysql"],"_links":{"self":[{"href":"http:\/\/www.spiceandwolf.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/2316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.spiceandwolf.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.spiceandwolf.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.spiceandwolf.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.spiceandwolf.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2316"}],"version-history":[{"count":20,"href":"http:\/\/www.spiceandwolf.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/2316\/revisions"}],"predecessor-version":[{"id":2563,"href":"http:\/\/www.spiceandwolf.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/2316\/revisions\/2563"}],"wp:attachment":[{"href":"http:\/\/www.spiceandwolf.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.spiceandwolf.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2316"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.spiceandwolf.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}