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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL 8.0.25 Bug 報"MY-013132 The table ...is full"MySql
- use azure data studio to create external table for oracleOracle
- TiDB 原始碼閱讀系列文章(二十)Table PartitionTiDB原始碼
- [20191203]enq: ZA - add std audit table partition.txtENQ
- ext4 lvreduce報錯superblock or the partition table is likely to be corruptVRBloC
- 今天測試了一下update partition table的part key
- ESP32 編譯報錯 57) boot: no bootable app partitions in the partition table編譯bootAPP
- MySQL:Analyze table導致'waiting for table flush'MySqlAI
- MySQL table into a golang strucMySqlGolang
- MySQL 鎖bug?MySql
- 教你解決ghost win10開機出現invalid partition table的方法Win10
- 【mysql】table中新增列MySql
- mysql的ALTER TABLE命令MySql
- MySQL rename table方法大全MySql
- Partition Pruning和Partition-Wise Joins
- MySQL報錯Table 'plugin' is read only [ERROR] Can't open the mysql.plugin table.MySqlPluginError
- MySQL 千萬級資料表 partition 實戰應用MySql
- mysql之 OPTIMIZE TABLE整理碎片MySql
- MySQL5.7 Waiting FOR TABLE FLUSHMySqlAI
- MySQL:Table_open_cache_hits/Table_open_cache_misses/Table_open_cache_overflowsMySql
- MySQL:關於Bug #81119MySql
- MYSQL connector 的 NullReferenceException bugMySqlNullException
- MySQL:關於Bug #20939184MySql
- Clique Partition
- [BUG反饋]子查詢報錯,Base table or view not found: 1146 Table 'onethink.(' doesn't existView
- 【MySQL】七、再說MySQL中的 table_idMySql
- MySQL5.6 create table原理分析MySql
- MySQL 關於Table cache設定MySql
- Mysql用optimize table 最佳化MySql
- oracle partition by group by,詳解partition by和group by對比Oracle
- MySQL全面瓦解29:使用Partition功能實現水平分割槽MySql
- MySQL UDF 在 in ( subquery where ) bugMySql
- 分割槽Partition
- MySQL-ALTER TABLE命令學習[20180503]MySql
- MySQL的create table as 與 like區別MySql
- MySQL新增索引偶遇waiting for table metadata lockMySql索引AI
- MySQL DDL Waiting for table metadata lock 解決MySqlAI
- 關於 mysql 中的 select * from table_a,table_b 的問題MySql
- 【轉載】Kano Model — Ways to use it and NOT use it