[MDEV-5171] Add support for --innodb-optimize-keys to mysqldump. Created: 2013-10-22 Updated: 2023-10-24 Resolved: 2023-04-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Scripts & Clients |
| Fix Version/s: | N/A |
| Type: | Task | Priority: | Major |
| Reporter: | Peter (Stig) Edwards | Assignee: | Marko Mäkelä |
| Resolution: | Won't Fix | Votes: | 5 |
| Labels: | None | ||
| Attachments: |
|
||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||
| Sprint: | 10.0.20, 10.0.21 | ||||||||||||||||||||||||
| Description |
|
Hello and thank you for mariadb, If the --innodb-optimize-keys mysqldump option was available with MariaDB I would use it when backing up and moving tables using mysqldump. It can also be used to shrink InnoDB table files on mysqld instances where "ALTER TABLE table_name ROW_FORMAT=Compact" does not result in fast index creation being used and where expand_fast_index_creation is not available so "OPTIMIZE TABLE table_name" and "ALTER TABLE table_name ENGINE=INNODB" do not use fast index creation. Having support for expand_fast_index_creation would also be great, but I think there is value from just adding the pragmatic mysqldump option. Applying the latest changes with fixes for the mysqldump option to MariaDB 10 was relatively easy. The original work and subsequent patches with tests having been created by Alexey Kopytov. Here are some links to the background: http://bugs.mysql.com/bug.php?id=57583 I tested using the example from Mark Callaghan in http://bugs.mysql.com/bug.php?id=57583
Thanks again. |
| Comments |
| Comment by Elena Stepanova [ 2013-10-22 ] | ||||
|
I suppose since it's just an option in a client program, it can be added even after 10.0.5, setting to 10.0.6 for now. | ||||
| Comment by Peter (Stig) Edwards [ 2013-10-23 ] | ||||
|
Alexey pointed me to a recent bug with mysqldump --innodb-optimize-keys in Percona Server, where incorrect CREATE TABLE statement for partitioned tables are produced, it has not been fixed yet: | ||||
| Comment by Peter (Stig) Edwards [ 2013-10-30 ] | ||||
|
This is a diff against 10.0, it contains just the changes needed for mysqldump from the Percona 5.5 code and two other tiny changes, an update to the man page and the addition of the warning for the duplicate index in the test result. Attribution may also be needed. added: This would still have this bug - https://bugs.launchpad.net/percona-server/+bug/1233841 | ||||
| Comment by Patryk Pomykalski [ 2013-11-25 ] | ||||
|
The above bug is fixed. | ||||
| Comment by Jan Lindström (Inactive) [ 2015-05-12 ] | ||||
|
http://lists.askmonty.org/pipermail/commits/2015-May/007813.html | ||||
| Comment by Jan Lindström (Inactive) [ 2015-07-27 ] | ||||
|
http://lists.askmonty.org/pipermail/commits/2015-July/008193.html Could you review this again, as I had to rewrite internal parser to support unquoted identifiers | ||||
| Comment by Rasmus Johansson (Inactive) [ 2016-11-28 ] | ||||
|
MySQL has the same feature request: | ||||
| Comment by Marko Mäkelä [ 2017-10-23 ] | ||||
|
Maybe the problem would be simply solved by using a special "bulk load" mechanism when executing a transaction that performs the first insert into an empty table or partition. This could be part of | ||||
| Comment by Sergei Golubchik [ 2018-02-14 ] | ||||
|
Wouldn't it be better for InnoDB to support ALTER TABLE DISABLE/ENABLE KEYS that mysqldump already uses around inserts anyway? A simple solution could be done purely in ha_innodb.cc, by dropping indexes on ALTER TABLE DISABLE KEYS and recreating them online on {{ALTER TABLE ENABLE KEYS. This won't require InnoDB to support disabled indexes and for an empty table dropping is fast. | ||||
| Comment by Marko Mäkelä [ 2021-02-09 ] | ||||
|
The scope of Unfortunately, currently mysqldump may generate multiple INSERT statements per table. Only the first INSERT statement into an empty table would be optimized by | ||||
| Comment by Daniel Black [ 2021-02-15 ] | ||||
|
The default mysqldump is with --opt, implying --extended-insert, so one INSERT per table. It can be configured otherwise. (up until the max-packet-size - default 24M) For LOAD DATA we'd need the mariadb client (or server - mysqldump isn't strictly for the consumption of mysql/mariadb client) to recognize a an inline version of LOAD DATA. Otherwise some form of multiple files like https://github.com/maxbube/mydumper/commits/master (that seems to be getting activity again). | ||||
| Comment by Marko Mäkelä [ 2021-05-26 ] | ||||
|
In | ||||
| Comment by Marko Mäkelä [ 2023-04-11 ] | ||||
|
The Description feels a bit outdated.
MariaDB 10.0.20 claims to be based on the InnoDB from MySQL 5.6.25. That version includes Alter_inplace_info::RECREATE_TABLE, which had been added in MySQL 5.6.13 to support OPTIMIZE TABLE using the WL#6255 InnoDB online table rebuild algorithm whose original version was released as part of MySQL 5.6.8. I think that the last missing piece to speed up data loading is MDEV-16281, to implement the multi-threaded creation of index trees. | ||||
| Comment by Marko Mäkelä [ 2023-10-24 ] | ||||
|
Note: To benefit from |