mysql partition table use to_days bug
to_days分割槽表 bug
CREATE TABLE `aaaaaaaaaa` (
`id` int(255) NOT NULL AUTO_INCREMENT,
`year` int(4) NOT NULL,
`month` int(2) NOT NULL,
`day` int(2) NOT NULL,
`startTime` datetime NOT NULL,
`endTime` datetime NOT NULL,
`version` varchar(12) NOT NULL DEFAULT '',
`source` varchar(12) NOT NULL DEFAULT '',
`sid` varchar(12) NOT NULL,
`valid` int(8) NOT NULL,
`error` int(8) NOT NULL,
`total` int(8) NOT NULL,
PRIMARY KEY (`id`,`startTime`,`version`,`source`,`sid`),
KEY `aaaaaaaaaa_index_startTime` (`startTime`),
KEY `aaaaaaaaaa_index_endTime` (`endTime`),
KEY `aaaaaaaaaa_muti_index` (`year`,`month`,`source`),
KEY `aaaaaaaaaa_index_source` (`source`),
KEY `month_index` (`month`),
KEY `year_index` (`year`)
) ENGINE=InnoDB AUTO_INCREMENT=1267666446 DEFAULT CHARSET=utf8
/*!50100 PARTITION BY RANGE (to_days(startTime))
(PARTITION p20160405 VALUES LESS THAN (736425) ENGINE = InnoDB,
PARTITION p20160620 VALUES LESS THAN (736501) ENGINE = InnoDB,
PARTITION p20160706 VALUES LESS THAN (736517) ENGINE = InnoDB) */
執行下面的sql,mysql 會crash
select sid as sid,source as source,sum(valid) as valid,sum(error) as error from aaaaaaaaaa where startTime>="2016-07-08 10:00:00"
通過下面的方法可以fix
alter table aaaaaaaaaa add PARTITION (partition p_max values less than(maxvalue));
另:
CREATE TABLE `aaaaaaaaaa` (
`id` int(255) NOT NULL AUTO_INCREMENT,
`year` int(4) NOT NULL,
`month` int(2) NOT NULL,
`day` int(2) NOT NULL,
`startTime` datetime NOT NULL,
`endTime` datetime NOT NULL,
`version` varchar(12) NOT NULL DEFAULT '',
`source` varchar(12) NOT NULL DEFAULT '',
`sid` varchar(12) NOT NULL,
`valid` int(8) NOT NULL,
`error` int(8) NOT NULL,
`total` int(8) NOT NULL,
PRIMARY KEY (`id`,`startTime`,`version`,`source`,`sid`)
) ENGINE=InnoDB AUTO_INCREMENT=1267666446 DEFAULT CHARSET=utf8
/*!50100 PARTITION BY RANGE (to_days(startTime))
(PARTITION p20160405 VALUES LESS THAN (736425) ENGINE = InnoDB,
PARTITION p20160620 VALUES LESS THAN (736501) ENGINE = InnoDB,
PARTITION p20160706 VALUES LESS THAN (736517) ENGINE = InnoDB) */
這樣不會出現上面的問題
但如果把starttime列加上索引 ,就會有這個問題
CREATE TABLE `aaaaaaaaaa` (
`id` int(255) NOT NULL AUTO_INCREMENT,
`year` int(4) NOT NULL,
`month` int(2) NOT NULL,
`day` int(2) NOT NULL,
`startTime` datetime NOT NULL,
`endTime` datetime NOT NULL,
`version` varchar(12) NOT NULL DEFAULT '',
`source` varchar(12) NOT NULL DEFAULT '',
`sid` varchar(12) NOT NULL,
`valid` int(8) NOT NULL,
`error` int(8) NOT NULL,
`total` int(8) NOT NULL,
PRIMARY KEY (`id`,`startTime`,`version`,`source`,`sid`),
KEY `aaaaaaaaaa_index_startTime` (`startTime`)
) ENGINE=InnoDB AUTO_INCREMENT=1267666446 DEFAULT CHARSET=utf8
/*!50100 PARTITION BY RANGE (to_days(startTime))
(PARTITION p20160405 VALUES LESS THAN (736425) ENGINE = InnoDB,
PARTITION p20160620 VALUES LESS THAN (736501) ENGINE = InnoDB,
PARTITION p20160706 VALUES LESS THAN (736517) ENGINE = InnoDB) */
MOS沒有找到相關的bug
5.1 5.6 中都沒有這個問題,5.5.24中有這個問題
轉載請註明源出處
QQ 273002188 歡迎一起學習
QQ 群 236941212
oracle,mysql,PG 相互交流
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25099483/viewspace-2121742/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- partition timestamp(0) not use partition
- partition table and partition indexIndex
- 拆分Table 為Partition Table
- partition table test
- partition table(1)
- partition table(2)
- When to Partition a Table
- [Oracle] Partition table exchange Heap tableOracle
- Oracle 普通table 轉換為partition tableOracle
- create a partition table using a exsit table
- 分割槽表PARTITION table
- partition table update partition-key result in changing tablespace
- db2 partition table testDB2
- Interval Partition table 11G
- Oracle分割槽表(Partition Table)Oracle
- How to partition a non-partitioned table
- 分割槽表PARTITION table(轉)
- partition table中truncate應用
- Use Excel Pivot Table as a BI toolExcel
- the "in" use in mysqlMySql
- MySQL 8.0.25 Bug 報"MY-013132 The table ...is full"MySql
- 關於partition table import的問題Import
- doesn't contain a valid partition tableAI
- add hash partition , default tablespace for patitioned table
- Hive partition prune的一個BugHive
- use azure data studio to create external table for oracleOracle
- 【DB】Direct Path EXP Corrupts The Dump If An Empty Table Partition Exists
- Applying “Incremental Statistic” for Oracle Big Partition TableAPPREMOracle
- 【MySQL】mysql optimize tableMySql
- Data Warehouse Guide閱讀筆記(七):partition tableGUIIDE筆記
- MySQL分割槽(Partition)詳解MySql
- ext4 lvreduce報錯superblock or the partition table is likely to be corruptVRBloC
- TiDB 原始碼閱讀系列文章(二十)Table PartitionTiDB原始碼
- Mycat+Mysql 插入資料包錯 i[Err] 1064 - partition table, insert must provide ColumnListMySqlIDE
- 今天測試了一下update partition table的part key
- MySQL table into a golang strucMySqlGolang
- create table of mysql databaseMySqlDatabase
- [oradebug命令學習2]How to Use Oradebug to Get Trace File Name and Location