一.innodb分区
1.先修改mysql的配置文件,添加 innodb_file_per_table=1
2.指定分区
CREATE TABLE `t_m` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`VinCode` varchar(20) DEFAULT NULL COMMENT 'VIN码',
`FilePath` varchar(200) DEFAULT NULL COMMENT '文件路径',
`Status` int(11) NOT NULL DEFAULT '0' COMMENT '文件上传 0新增文件1正在解析列队文件2未在解析列队文件',
`PhoneType` int(11) DEFAULT '0',
`LastUploadDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`,`LastUploadDate`)
) ENGINE=InnoDb AUTO_INCREMENT=3 DEFAULT CHARSET=utf8
PARTITION BY RANGE (YEAR(LastUploadDate))
(PARTITION p0 VALUES LESS THAN (2010) ,
PARTITION p1 VALUES LESS THAN (2011) ,
PARTITION p2 VALUES LESS THAN (2012),
PARTITION p3 VALUES LESS THAN (2013) ,
PARTITION p4 VALUES LESS THAN (2014) ,
PARTITION p5 VALUES LESS THAN (2015) ,
PARTITION p6 VALUES LESS THAN (2016),
PARTITION p7 VALUES LESS THAN (2017),
PARTITION p8 VALUES LESS THAN (2018),
PARTITION p9 VALUES LESS THAN (2019),
PARTITION p10 VALUES LESS THAN MAXVALUE ENGINE = InnoDb);