{"id":3057,"date":"2016-05-30T13:59:36","date_gmt":"2016-05-30T05:59:36","guid":{"rendered":"http:\/\/blog.hoyo.idv.tw\/?p=3057"},"modified":"2019-04-08T13:22:18","modified_gmt":"2019-04-08T05:22:18","slug":"mysql-partitioning-%e5%88%86%e5%8d%80","status":"publish","type":"post","link":"https:\/\/blog.hoyo.idv.tw\/?p=3057","title":{"rendered":"MySQL Partitioning \u5206\u5340"},"content":{"rendered":"<p>--<\/p>\n<h2>\u9650\u5236<\/h2>\n<ul>\n<li><a href=\"https:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/partitioning-limitations.html\" target=\"_blank\" rel=\"noopener\">Restrictions and Limitations on Partitioning<\/a><br \/>\n\u5206\u5340\u8cc7\u6599\u8868\u5c31\u4e0d\u652f\u63f4\u00a0Foreign key<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>--<\/p>\n<p>MySQL \u5206\u5340\u53ef\u4ee5\u8a2d\u5b9a\u66f4\u6539\u539f\u5148\u8cc7\u6599\u5132\u5b58\u7d50\u679c\u3002<\/p>\n<p>\u4ee5 MYISAM \u5f15\u64ce\u70ba\u4f8b\uff0c\u539f\u672c\u4e00\u500b A \u8cc7\u6599\u8868\u5728\u786c\u789f\u6703\u5b58\u5728<\/p>\n<ul>\n<li>A.frm<\/li>\n<li>A.MYD<\/li>\n<li>A.MYI<\/li>\n<\/ul>\n<p>\u4e09\u500b\u6a94\u6848\uff0c\u7121\u8ad6\u8cc7\u6599\u7b46\u6578\u591a\u5be1\u90fd\u653e\u5728\u540c\u4e00\u6a94\u6848\u5167\uff0c\u9019\u6642\u8cc7\u6599\u5132\u5b58\u9650\u5236 == \u4f5c\u696d\u7cfb\u7d71\u55ae\u4e00\u6a94\u6848\u5927\u5c0f\u9650\u5236\u3002\u5728\u76ee\u524d\u4e3b\u6d41\u6a94\u6848\u7cfb\u7d71\u4e4b\u4e0b\uff0c\u55ae\u4e00\u6a94\u6848\u5927\u5c0f\u9650\u5236\u5728 4G ~ 16TByte \u4e4b\u9593\u3002<\/p>\n<p>\u8cc7\u6599\u8868\u592a\u5927\u5c0d\u8cc7\u6599\u5eab\u4e0d\u662f\u597d\u4e8b\uff0c\u6709\u53ef\u80fd\u53ea\u70ba\u4e86\u8b80\u53d6 10Byte \u7684\u8cc7\u6599\uff0c\u537b\u5c07\u6574\u500b\u8cc7\u6599\u8868\u90fd\u8b80\u53d6\u4e00\u904d\uff0c\u5982\u679c\u53ef\u80fd\u9084\u662f\u9700\u8981\u63a7\u5236\u8cc7\u6599\u8868\u7684\u5be6\u9ad4\u5132\u5b58\u5bb9\u91cf\uff0c\u9054\u5230\u589e\u9032\u6548\u80fd\u4ee5\u53ca\u65b9\u4fbf\u7ba1\u7406\u7684\u76ee\u7684\u3002<\/p>\n<p>\u53c3\u8003<\/p>\n<ul>\n<li><a href=\"http:\/\/clhjoe.blogspot.tw\/2014\/04\/i.html\" target=\"_blank\" rel=\"noopener\">\u5927\u8cc7\u6599\u8cc7\u6599\u5eab\u5132\u5b58--\u50b3\u7d71\u7684\u89e3\u6c7a\u65b9\u6848(I)<\/a><\/li>\n<li><a href=\"http:\/\/lobert.iteye.com\/blog\/1955841\">\u5b9e\u6218mysql\u5206\u533a(PARTITION)<\/a><\/li>\n<li><a href=\"http:\/\/xuebinbin212.blog.163.com\/blog\/static\/112167376201111294041677\/\" target=\"_blank\" rel=\"noopener\">Mysql 5.1\u5206\u533a\u7279\u6027\u53ca5.5\u7684\u5173\u4e8e\u5206\u533a\u7684\u5347\u7ea7<\/a><\/li>\n<li><a href=\"http:\/\/twpug.net\/docs\/mysql-5.1\/partitioning.html\" target=\"_blank\" rel=\"noopener\">Chapter 18. Partitioning<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<pre class=\"lang:mysql decode:true\">CREATE TABLE part_tab ( \r\n    c1 int default NULL,\r\n    c2 varchar(30) default NULL,\r\n    c3 date default NULL\r\n) engine=myisam\r\nPARTITION BY RANGE (year(c3)) (\r\n    PARTITION p0 VALUES LESS THAN (1995),\r\n    PARTITION p1 VALUES LESS THAN (1996),\r\n    PARTITION p2 VALUES LESS THAN (1997),\r\n    PARTITION p3 VALUES LESS THAN (1998),\r\n    PARTITION p4 VALUES LESS THAN (1999),\r\n    PARTITION p5 VALUES LESS THAN (2000),\r\n    PARTITION p6 VALUES LESS THAN (2001),\r\n    PARTITION p7 VALUES LESS THAN (2002),\r\n    PARTITION p8 VALUES LESS THAN (2003),\r\n    PARTITION p9 VALUES LESS THAN (2004),\r\n    PARTITION p10 VALUES LESS THAN (2010),\r\n    PARTITION p11 VALUES LESS THAN MAXVALUE\r\n);<\/pre>\n<p><a href=\"http:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/MySQL_Partitioning01.png\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-3058\" src=\"\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/MySQL_Partitioning01-300x229.png\" alt=\"MySQL_Partitioning01\" width=\"300\" height=\"229\" srcset=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/MySQL_Partitioning01-300x229.png 300w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/MySQL_Partitioning01-392x300.png 392w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/MySQL_Partitioning01.png 693w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h2>\u4ee5\u6642\u9593\u4f5c\u70ba\u5206\u5340\u4f9d\u64da<\/h2>\n<p>\u4ee5\u4e00\u500b\u6709\u00a0AUTO_INCREMENT \u53ca\u00a0CURRENT_TIMESTAMP \u7684\u8cc7\u6599\u8868\u70ba\u4f8b\uff0c<\/p>\n<p>\u95dc\u9375\u662f\u300c<span style=\"color: #ff0000;\"><strong>\u5fc5\u9808\u628a\u5340\u5206\u6642\u9593\u7684\u6b04\u4f4d\u5305\u542b\u5230 Primary Key \u5167<\/strong><\/span>\u300d<\/p>\n<pre class=\"lang:mysql decode:true\">CREATE TABLE IF NOT EXISTS `NODE1p` (\r\n  `id` int(255) NOT NULL AUTO_INCREMENT,\r\n  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\r\n  `V0` float NOT NULL DEFAULT '0',\r\n  `V1` float NOT NULL DEFAULT '0',\r\n  `V2` float NOT NULL DEFAULT '0',\r\n  `V3` float NOT NULL DEFAULT '0',\r\n  `V4` float NOT NULL DEFAULT '0',\r\n  `V5` float NOT NULL DEFAULT '0',\r\n  PRIMARY KEY (`id`, `time`)\r\n) ENGINE=myisam DEFAULT CHARSET=utf8 AUTO_INCREMENT=1\r\nPARTITION BY RANGE (UNIX_TIMESTAMP(`time`)) (\r\n    PARTITION p2014 VALUES LESS THAN (UNIX_TIMESTAMP('2015-01-01 00:00:00')),\r\n    PARTITION p2015 VALUES LESS THAN (UNIX_TIMESTAMP('2016-01-01 00:00:00')),\r\n    PARTITION pNOW VALUES LESS THAN MAXVALUE\r\n);<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:mysql decode:true\">INSERT \u65b0\u7684\u5206\u5340\u8cc7\u6599\u8868 SELECT * FROM \u539f\u8cc7\u6599\u8868;<\/pre>\n<p>--<\/p>\n<p><strong>\u4e00\u500b\u5c07\u7121\u5206\u5340\u8cc7\u6599\u8868\u4fee\u6539\u70ba\u5177\u5206\u5340\u529f\u80fd\u7bc4\u4f8b<\/strong><\/p>\n<ol>\n<li>\u5efa\u7acb\u4e00\u500b\u5177\u6709\u5206\u5340\u529f\u80fd\u8cc7\u6599\u8868\uff0c\u5fc5\u9808\u548c\u539f\u8cc7\u6599\u8868\u8cc7\u6599\u7d50\u69cb\u76f8\u540c\uff0c\u6e96\u5099\u505a\u66ff\u63db\u7528<\/li>\n<li>\u5c07\u539f\u8cc7\u6599\u8868\u8cc7\u6599\u8907\u88fd\u5230\u6b64\u5206\u5340\u8cc7\u6599\u8868\uff0c\u4f7f\u7528\u7684\u662f INSERT SELECT \u8a9e\u6cd5<\/li>\n<li>\u522a\u9664\u539f\u8cc7\u6599\u8868<\/li>\n<li>\u5c07\u5206\u5340\u8cc7\u6599\u8868\u540d\u7a31\u66f4\u63db\u70ba\u539f\u8cc7\u6599\u8868\u540d\u7a31<\/li>\n<\/ol>\n<pre class=\"lang:mysql decode:true\">CREATE TABLE IF NOT EXISTS `NODE1p` (\r\n  `id` int(255) NOT NULL AUTO_INCREMENT,\r\n  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\r\n  `V0` float NOT NULL DEFAULT '0',\r\n  `V1` float NOT NULL DEFAULT '0',\r\n  `V2` float NOT NULL DEFAULT '0',\r\n  `V3` float NOT NULL DEFAULT '0',\r\n  `V4` float NOT NULL DEFAULT '0',\r\n  `V5` float NOT NULL DEFAULT '0',\r\n  PRIMARY KEY (`id`, `time`)\r\n) ENGINE=myisam DEFAULT CHARSET=utf8 AUTO_INCREMENT=1\r\nPARTITION BY RANGE (UNIX_TIMESTAMP(`time`)) (\r\n    PARTITION p2014 VALUES LESS THAN (UNIX_TIMESTAMP('2015-01-01 00:00:00')),\r\n    PARTITION p2015 VALUES LESS THAN (UNIX_TIMESTAMP('2016-01-01 00:00:00')),\r\n    PARTITION p2016 VALUES LESS THAN (UNIX_TIMESTAMP('2017-01-01 00:00:00')),\r\n    PARTITION p2017 VALUES LESS THAN (UNIX_TIMESTAMP('2018-01-01 00:00:00')),\r\n    PARTITION p2018 VALUES LESS THAN (UNIX_TIMESTAMP('2019-01-01 00:00:00')),\r\n    PARTITION p2019 VALUES LESS THAN (UNIX_TIMESTAMP('2020-01-01 00:00:00')),\r\n    PARTITION p2020 VALUES LESS THAN (UNIX_TIMESTAMP('2021-01-01 00:00:00')),\r\n    PARTITION p2021 VALUES LESS THAN (UNIX_TIMESTAMP('2022-01-01 00:00:00')),\r\n    PARTITION p2022 VALUES LESS THAN (UNIX_TIMESTAMP('2023-01-01 00:00:00')),\r\n    PARTITION p2023 VALUES LESS THAN (UNIX_TIMESTAMP('2024-01-01 00:00:00')),\r\n    PARTITION pNOW VALUES LESS THAN MAXVALUE\r\n);\r\n\r\nINSERT `NODE1p` SELECT * FROM `NODE1`;\r\nDROP TABLE `NODE1`;\r\nRENAME TABLE `NODE1p` TO `NODE1` ;<\/pre>\n<p>--<\/p>\n<p><strong>\u986f\u793a\u8cc7\u6599\u8868\u5206\u5340\u8cc7\u8a0a<\/strong><\/p>\n<p>\u4f7f\u7528\u7684\u662f\u986f\u793a\u5efa\u7acb\u8cc7\u6599\u8868\u8cc7\u8a0a\u6280\u5de7<\/p>\n<pre class=\"lang:mysql decode:true\">SHOW CREATE TABLE<\/pre>\n<p>--<\/p>\n<p><strong>\u4e00\u500b\u5206\u5340\u8cc7\u6599\u8868\u5efa\u7acb\u5f8c\u4fee\u6539\u7bc4\u4f8b<\/strong><\/p>\n<pre class=\"lang:mysql decode:true\">CREATE TABLE `NODE2p` (\r\n `id` int(255) NOT NULL AUTO_INCREMENT,\r\n `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\r\n `V0` float NOT NULL DEFAULT '0',\r\n `V1` float NOT NULL DEFAULT '0',\r\n `V2` float NOT NULL DEFAULT '0',\r\n `V3` float NOT NULL DEFAULT '0',\r\n `V4` float NOT NULL DEFAULT '0',\r\n `V5` float NOT NULL DEFAULT '0',\r\n PRIMARY KEY (`id`,`time`)\r\n) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8\r\n\/*!50100 PARTITION BY RANGE (UNIX_TIMESTAMP(`time`))\r\n(PARTITION p2014 VALUES LESS THAN (1388505600) ENGINE = MyISAM,\r\nPARTITION p2015 VALUES LESS THAN (1420041600) ENGINE = MyISAM,\r\nPARTITION pNOW VALUES LESS THAN MAXVALUE ENGINE = MyISAM) *\/<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:mysql decode:true\">ALTER TABLE NODE2p REORGANIZE PARTITION pNOW INTO (\r\n    PARTITION p201601 VALUES LESS THAN (UNIX_TIMESTAMP('2016-02-01 00:00:00')),\r\n    PARTITION p201602 VALUES LESS THAN (UNIX_TIMESTAMP('2016-03-01 00:00:00')),\r\n    PARTITION pNOW VALUES LESS THAN MAXVALUE\r\n);<\/pre>\n<p>&nbsp;<\/p>\n<p>--<\/p>\n<h2>\u5206\u5340\u5340\u5206\u5230\u5e74\u3001\u6708<\/h2>\n<ul>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/19355024\/mysql-table-partition-by-month\">MySQL table partition by month<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \">CREATE TABLE IF NOT EXISTS `J` (\r\n  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '\u4e3b\u9375',\r\n  `Create_Time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '\u5efa\u7acb\u6642\u9593',\r\n  `AuctionDate` date NOT NULL,\r\n  `AuctionNumber` int(11) NOT NULL,\r\n  PRIMARY KEY (`id`, `AuctionDate`)\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1\r\nPARTITION BY RANGE((YEAR(`AuctionDate`) * 100) + MONTH(`AuctionDate`))(\r\n    PARTITION p199501 VALUES LESS THAN (199501),\r\n    PARTITION p199502 VALUES LESS THAN (199502)\r\n);\r\n<\/pre>\n<p>\u9806\u4fbf\u8aaa\u4e00\u500b\u60c5\u6cc1\uff0c\u7b2c\u4e00\u500b\u8a2d\u5b9a\u662f 199501 \uff0c\u4ee3\u8868 1995\u5e741\u6708\u4ee5\u524d\u7684\u8cc7\u6599\u5b58\u5728\u6b64\uff0c\u800c199502 \u5247\u53ea\u5b58\u653e 1995\u5e74 2 \u6708\u7684\u8cc7\u6599\uff0c\u56e0\u70ba\u6c92\u6709\u00a0MAXVALUE \u6240\u4ee5\u8d85\u904e\u7684\u65e5\u671f\u6703\u65b0\u589e\u5931\u6557<\/p>\n<p>--<\/p>\n<h2>InnoDB \u5982\u4f55\u5206\u5340\u5340\u5206\u6a94\u6848<\/h2>\n<ul>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/3927690\/howto-clean-a-mysql-innodb-storage-engine\">Howto: Clean a mysql InnoDB storage engine?<\/a><\/li>\n<li><a href=\"https:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/tablespace-enabling.html\" target=\"_blank\" rel=\"noopener\">14.7.4.1 Enabling and Disabling File-Per-Table Tablespaces<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \">vi \/etc\/my.cnf\r\n\r\n[mysqld]\r\ninnodb_file_per_table=1<\/pre>\n<p>\u91cd\u65b0\u555f\u52d5\u8cc7\u6599\u5eab<\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-3608 size-full\" src=\"\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/Image-500.png\" width=\"533\" height=\"76\" srcset=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/Image-500.png 533w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/Image-500-300x43.png 300w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/Image-500-500x71.png 500w\" sizes=\"(max-width: 533px) 100vw, 533px\" \/><\/p>\n<p>--<\/p>\n<h2>\u4f7f\u7528 HASH<\/h2>\n<ul>\n<li><a href=\"https:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/partitioning-hash.html\" target=\"_blank\" rel=\"noopener\">HASH Partitioning<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \">CREATE TABLE IF NOT EXISTS `Data2` (\r\n  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '\u4e3b\u9375',\r\n  `Create_Time` datetime NOT NULL COMMENT '\u5efa\u7acb\u6642\u9593',\r\n  `Device_id` int(11) NOT NULL,\r\n  `Key` enum('Temperature1','Humidity1','Watt1','WalkStep1') NOT NULL,\r\n  `Value` decimal(24,12) NOT NULL,\r\n  `is_Del` enum('Y','N') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'N' COMMENT '\u662f\u5426\u522a\u9664',\r\n  UNIQUE KEY `id` (`id`,`Create_Time`),\r\n  KEY `Device_id` (`Device_id`)\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;<\/pre>\n<p>\u4f7f\u7528\u00a0Create_Time \u8f49\u5929\u6578\u5f8c hash<\/p>\n<pre class=\"lang:default decode:true\">ALTER TABLE `Data2` PARTITION BY hash (TO_DAYS(Create_Time)) partitions 31;<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true\">SELECT TO_DAYS( '0001-01-01' );\r\n-&gt; 366<\/pre>\n<p>\u5f9e\u63d2\u5165\u591a\u7b46 2018\/06\/07 \u8cc7\u6599\u4f86\u89c0\u5bdf HASH \u5132\u5b58\u8cc7\u6599\u908f\u8f2f<\/p>\n<pre class=\"lang:default decode:true \">SELECT TO_DAYS('2018-06-07');\r\n-&gt; 737217\r\n\r\nSELECT MOD(737217,31);\r\n-&gt; 6<\/pre>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-4729\" src=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/Image-183.png\" alt=\"\" width=\"591\" height=\"149\" srcset=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/Image-183.png 591w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/Image-183-300x76.png 300w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/Image-183-500x126.png 500w\" sizes=\"(max-width: 591px) 100vw, 591px\" \/><\/p>\n<p>--<\/p>\n<h2>\u5206\u5340\u522a\u9664\u5408\u4f75\u6a94\u6848\u8b8a\u5316<\/h2>\n<p>\u5206\u5340\u6703\u5c07\u6a94\u6848\u6839\u64da\u689d\u4ef6\u5206\u958b\uff0c\u522a\u9664\u5206\u5340\u6a94\u6848\u5c31\u6703\u5408\u4f75\uff1f<\/p>\n<p>\u7406\u8ad6\u4e0a\u662f\u5982\u6b64\uff0c\u5be6\u969b\u6e2c\u8a66\u4ea6\u662f\u5982\u6b64<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-4732\" src=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/Image-210.png\" alt=\"\" width=\"596\" height=\"401\" srcset=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/Image-210.png 596w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/Image-210-300x202.png 300w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2016\/05\/Image-210-446x300.png 446w\" sizes=\"(max-width: 596px) 100vw, 596px\" \/><\/p>\n<p>--<\/p>\n<h2>\u67e5\u8a62\u6642\u662f\u5426\u6709\u6548\u5957\u7528\u5230\u5206\u5340\uff1f<\/h2>\n<p>\u4f7f\u7528\u00a0EXPLAIN PARTITIONS \u53ef\u4ee5\u67e5\u8a62\u53d6\u7528\u5206\u5340\u6a94\u6848\u7684\u72c0\u614b<\/p>\n<pre class=\"lang:default decode:true\">EXPLAIN PARTITIONS SELECT * \r\nFROM  `Data2` \r\nWHERE Create_Time =  '2018-06-07'<\/pre>\n<table id=\"table_results\" class=\"ajax pma_table\">\n<thead>\n<tr>\n<th class=\"draggable\" data-column=\"id\">id<\/th>\n<th class=\"draggable\" data-column=\"select_type\">select_type<\/th>\n<th class=\"draggable\" data-column=\"table\">table<\/th>\n<th class=\"draggable\" data-column=\"partitions\">partitions<\/th>\n<th class=\"draggable\" data-column=\"type\">type<\/th>\n<th class=\"draggable\" data-column=\"possible_keys\">possible_keys<\/th>\n<th class=\"draggable\" data-column=\"key\">key<\/th>\n<th class=\"draggable\" data-column=\"key_len\">key_len<\/th>\n<th class=\"draggable\" data-column=\"ref\">ref<\/th>\n<th class=\"draggable\" data-column=\"rows\">rows<\/th>\n<th class=\"draggable\" data-column=\"Extra\">Extra<\/th>\n<td><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr class=\"odd\">\n<td class=\"right data not_null nowrap \">1<\/td>\n<td class=\"data not_null \">SIMPLE<\/td>\n<td class=\"data \">Data2<\/td>\n<td class=\"left data \">p6<\/td>\n<td class=\"data \">ALL<\/td>\n<td class=\"data null\"><i>NULL<\/i><\/td>\n<td class=\"data null\"><i>NULL<\/i><\/td>\n<td class=\"data null\"><i>NULL<\/i><\/td>\n<td class=\"data null\"><i>NULL<\/i><\/td>\n<td class=\"right data nowrap \">2738<\/td>\n<td class=\"data not_null \">Using where<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5982\u679c\u67e5\u8a0a\u8de8\u5230\u591a\u65e5\u5c31\u6703\u67e5\u8a62\u5230\u591a\u500b\u6216\u662f\u5168\u90e8\u7684\u5206\u5340\u6a94\u6848\uff0c\u5982\u6b64\u5c31\u5931\u53bb\u5206\u5340\u4f5c\u7528<\/p>\n<p>--<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"3057\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;4,736&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>-- \u9650\u5236 Restricti...<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"3057\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;4,736&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[258],"tags":[153,250,247,249,248],"_links":{"self":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/3057"}],"collection":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3057"}],"version-history":[{"count":16,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/3057\/revisions"}],"predecessor-version":[{"id":3108,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/3057\/revisions\/3108"}],"wp:attachment":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}