mysqldump --innodb-optimize-keys handles AUTO_INCREMENT columns inefficiently
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Server moved to https://jira.percona.com/projects/PS |
Fix Released
|
Undecided
|
Alexey Kopytov | ||
5.1 |
Fix Released
|
Undecided
|
Alexey Kopytov | ||
5.5 |
Fix Released
|
Undecided
|
Alexey Kopytov |
Bug Description
When mysqldump --innodb-
However, it avoids optimizing all keys indexing that column from , even though it would be sufficient to avoid optimization just for the first one.
For example: the following table definition:
CREATE TABLE t2 (
id INT NOT NULL AUTO_INCREMENT,
uid INT NOT NULL,
PRIMARY KEY (id),
KEY k1 (id),
KEY k2 (id)
) ENGINE=InnoDB;
results in the following output by mysqldump --innodb-
DROP TABLE IF EXISTS `t2`;
/*!40101 SET @saved_cs_client = @@character_
/*!40101 SET character_
CREATE TABLE `t2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `k1` (`id`),
KEY `k2` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
Obviously, creating the table with just the primary key would be sufficient, and keys 'k1' and 'k2' can be created after loading the data.
Related branches
- Laurynas Biveinis (community): Approve
-
Diff: 339 lines (+222/-35)3 files modifiedPercona-Server/client/mysqldump.c (+108/-35)
Percona-Server/mysql-test/r/percona_mysqldump_innodb_optimize_keys.result (+74/-0)
Percona-Server/mysql-test/t/percona_mysqldump_innodb_optimize_keys.test (+40/-0)
- Laurynas Biveinis (community): Approve
-
Diff: 1449 lines (+108/-589)3 files modifiedPercona-Server/client/mysqldump.c (+108/-34)
Percona-Server/mysql-test/r/percona_mysqldump_innodb_optimize_keys.result (+0/-367)
Percona-Server/mysql-test/t/percona_mysqldump_innodb_optimize_keys.test (+0/-188)
Percona now uses JIRA for bug reports so this bug report is migrated to: https:/ /jira.percona. com/browse/ PS-2837