从MySQL 8.0版本开始,就不允许创建 MyISAM 分区表了,只允许创建已经实现了本地分区策略的引擎。
到目前为止,只有InnoDB和NDB这两个引擎支持本地分区策略。
【1】实际测试
(1)数据库版本号
# 获取版本号 SELECT VERSION(); # 8.0.12
(2)键表InnoDB引擎
CREATE TABLE `t_innodb` ( `ftime` DATETIME NOT NULL, `c` INT(11) DEFAULT NULL, KEY (`ftime`) ) ENGINE=INNODB DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(ftime)) (PARTITION p_2017 VALUES LESS THAN (2017) ENGINE = INNODB, PARTITION p_2018 VALUES LESS THAN (2018) ENGINE = INNODB, PARTITION p_2019 VALUES LESS THAN (2019) ENGINE = INNODB, PARTITION p_others VALUES LESS THAN MAXVALUE ENGINE = INNODB);
创建成功。
(3)MyiSAM引擎
CREATE TABLE `t_myisam` ( `ftime` DATETIME NOT NULL, `c` INT(11) DEFAULT NULL, KEY (`ftime`) ) ENGINE=INNODB DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(ftime)) (PARTITION p_2017 VALUES LESS THAN (2017) ENGINE = MYISAM, PARTITION p_2018 VALUES LESS THAN (2018) ENGINE = MYISAM, PARTITION p_2019 VALUES LESS THAN (2019) ENGINE = MYISAM, PARTITION p_others VALUES LESS THAN MAXVALUE ENGINE = MYISAM);
创建失败:
Good Good Study, Day Day Up.
顺序 选择 循环 总结
原文地址:https://www.cnblogs.com/Braveliu/p/11423159.html
时间: 2024-10-09 12:49:37