我想了解一下,如果RANGE TO_DAY(DateCol)和RANGE COLUMN(DateCol)按日期划分MySQL RANGE之间有任何区别。
MySQL版本:5.7.12
示例测试脚本:
CREATE TABLE log_tbl_1 (
id bigint(20) NOT NULL AUTO_INCREMENT,
stime datetime not NULL,
primary KEY id (id, stime)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
PARTITION BY RANGE COLUMNS( stime ) (
PARTITION p20180401 VALUES LESS THAN ('2018-04-02'),
PARTITION p20180402 VALUES LESS THAN ('2018-04-03'),
PARTITION p20180403 VALUES LESS THAN ('2018-04-04'),
PARTITION p20180404 VALUES LESS THAN ('2018-04-05'),
PARTITION p20180405 VALUES LESS THAN ('2018-04-06'),
PARTITION p20180406 VALUES LESS THAN ('2018-04-07')
);
CREATE TABLE log_tbl_2 (
id bigint(20) NOT NULL AUTO_INCREMENT,
stime datetime not NULL,
primary KEY id (id, stime)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
PARTITION BY RANGE(to_days(stime)) (
PARTITION t20180401 VALUES LESS THAN (to_days('2018-04-02')),
PARTITION t20180402 VALUES LESS THAN (to_days('2018-04-03')),
PARTITION t20180403 VALUES LESS THAN (to_days('2018-04-04')),
PARTITION t20180404 VALUES LESS THAN (to_days('2018-04-05')),
PARTITION t20180405 VALUES LESS THAN (to_days('2018-04-06')),
PARTITION t20180406 VALUES LESS THAN (to_days('2018-04-07'))
);
任何帮助将不胜感激。在此先感谢:)