1 頁 (共 1 頁)

MySQL partition table

發表於 : 2016-10-06 21:01:58
yehlu
create

代碼: 選擇全部

 SHOW CREATE TABLE sell_pp;

代碼: 選擇全部

 CREATE TABLE `sell_pp` (
  `sell_id` int(11) unsigned zerofill NOT NULL,
  `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '交易日期',
  PRIMARY KEY (`sell_id`,`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
/*!50100 PARTITION BY RANGE (year(date))
(PARTITION p0 VALUES LESS THAN (2005) ENGINE = MyISAM,
 PARTITION p1 VALUES LESS THAN (2010) ENGINE = MyISAM,
 PARTITION p2 VALUES LESS THAN (2015) ENGINE = MyISAM,
 PARTITION p3 VALUES LESS THAN (2020) ENGINE = MyISAM,
 PARTITION p4 VALUES LESS THAN (2025) ENGINE = MyISAM,
 PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ |

Re: MySQL partition table

發表於 : 2016-10-06 21:03:07
yehlu

代碼: 選擇全部

use information_schema
select table_name, partition_name, table_rows from partitions where table_name = 'sell_pp' and partition_name is not null;
+------------+----------------+------------+
| table_name | partition_name | table_rows |
+------------+----------------+------------+
| sell_pp    | p0             |          0 |
| sell_pp    | p1             |          0 |
| sell_pp    | p2             |          0 |
| sell_pp    | p3             |          0 |
| sell_pp    | p4             |          0 |
| sell_pp    | p5             |          0 |
| sell_pp    | p0             |     109371 |
| sell_pp    | p1             |     834244 |
| sell_pp    | p2             |    1632618 |
| sell_pp    | p3             |      39046 |
| sell_pp    | p4             |          0 |
| sell_pp    | p5             |          0 |
+------------+----------------+------------+
12 rows in set (0.01 sec)