DISABLE KEYS : ignoring secondary indexes, until they are reenabled with ENABLE KEYS.
Also ignoring foreign key constraints, I'd guess (although, there is another setting for that)
This is a tool that MyISAM/Aria use for the data load, into the empty table.
The idea is to insert a lot of data (one can assume primary key order for this specific case),
then build all indexes indexes on ENABLE.
This should make restoring of mariadb-dump, and mariadb-import automatically faster.
There is alternative for the data loading tools, to parse the table DDL as given by SHOW CREATE TABLE (MDEV-34740), but ENABLE/DISABLE appears to be much more convenient
Attachments
Issue Links
relates to
MDEV-5171 Add support for --innodb-optimize-keys to mysqldump.
Implementing ALTER TABLE…DISABLE KEYS would require a change to the InnoDB data dictionary format, or maybe better to the data file format (MDEV-11658), to incidate that some indexes need to be rebuilt before they can be used.
Implementing ALTER TABLE…ENABLE KEYS would be somewhat tricky. I assume that it currently is a blocking operation, because neither MyISAM nor Aria support ALTER TABLE…ALGORITHM=INPLACE, LOCK=NONE. It might be best if the in-datafile index metadata records that I have envisioned in MDEV-11658 would be covered by undo log records. In that way, killing or backing up a server during such an operation should be manageable.
Marko Mäkelä
added a comment - Implementing ALTER TABLE…DISABLE KEYS would require a change to the InnoDB data dictionary format, or maybe better to the data file format ( MDEV-11658 ), to incidate that some indexes need to be rebuilt before they can be used.
Implementing ALTER TABLE…ENABLE KEYS would be somewhat tricky. I assume that it currently is a blocking operation, because neither MyISAM nor Aria support ALTER TABLE…ALGORITHM=INPLACE, LOCK=NONE . It might be best if the in-datafile index metadata records that I have envisioned in MDEV-11658 would be covered by undo log records. In that way, killing or backing up a server during such an operation should be manageable.
People
Unassigned
Vladislav Vaintroub
Votes:
0Vote for this issue
Watchers:
4Start watching this issue
Dates
Created:
Updated:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1351.7999999970198,"ttfb":368.3999999985099,"pageVisibility":"visible","entityId":130319,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"25bd7b3d-f049-4c5c-8e72-11112ca00ffe","navigationType":0,"readyForUser":1422.1000000014901,"redirectCount":0,"resourceLoadedEnd":1659.2000000029802,"resourceLoadedStart":373.70000000298023,"resourceTiming":[{"duration":484.3999999985099,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":373.70000000298023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":373.70000000298023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":858.1000000014901,"responseStart":0,"secureConnectionStart":0},{"duration":484.3999999985099,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":374,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":374,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":858.3999999985099,"responseStart":0,"secureConnectionStart":0},{"duration":502,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":374.20000000298023,"connectEnd":374.20000000298023,"connectStart":374.20000000298023,"domainLookupEnd":374.20000000298023,"domainLookupStart":374.20000000298023,"fetchStart":374.20000000298023,"redirectEnd":0,"redirectStart":0,"requestStart":374.20000000298023,"responseEnd":876.2000000029802,"responseStart":876.2000000029802,"secureConnectionStart":374.20000000298023},{"duration":543.8000000044703,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":374.3999999985099,"connectEnd":374.3999999985099,"connectStart":374.3999999985099,"domainLookupEnd":374.3999999985099,"domainLookupStart":374.3999999985099,"fetchStart":374.3999999985099,"redirectEnd":0,"redirectStart":0,"requestStart":374.3999999985099,"responseEnd":918.2000000029802,"responseStart":918.2000000029802,"secureConnectionStart":374.3999999985099},{"duration":547.7000000029802,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":374.5,"connectEnd":374.5,"connectStart":374.5,"domainLookupEnd":374.5,"domainLookupStart":374.5,"fetchStart":374.5,"redirectEnd":0,"redirectStart":0,"requestStart":374.5,"responseEnd":922.2000000029802,"responseStart":922.2000000029802,"secureConnectionStart":374.5},{"duration":548.0999999940395,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":374.70000000298023,"connectEnd":374.70000000298023,"connectStart":374.70000000298023,"domainLookupEnd":374.70000000298023,"domainLookupStart":374.70000000298023,"fetchStart":374.70000000298023,"redirectEnd":0,"redirectStart":0,"requestStart":374.70000000298023,"responseEnd":922.7999999970198,"responseStart":922.7999999970198,"secureConnectionStart":374.70000000298023},{"duration":548.2999999970198,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":375,"connectEnd":375,"connectStart":375,"domainLookupEnd":375,"domainLookupStart":375,"fetchStart":375,"redirectEnd":0,"redirectStart":0,"requestStart":375,"responseEnd":923.2999999970198,"responseStart":923.2999999970198,"secureConnectionStart":375},{"duration":646.3999999985099,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":375.1000000014901,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":375.1000000014901,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1021.5,"responseStart":0,"secureConnectionStart":0},{"duration":548.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":375.29999999701977,"connectEnd":375.29999999701977,"connectStart":375.29999999701977,"domainLookupEnd":375.29999999701977,"domainLookupStart":375.29999999701977,"fetchStart":375.29999999701977,"redirectEnd":0,"redirectStart":0,"requestStart":375.29999999701977,"responseEnd":923.7999999970198,"responseStart":923.7999999970198,"secureConnectionStart":375.29999999701977},{"duration":646.2000000029802,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":375.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":375.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1021.7000000029802,"responseStart":0,"secureConnectionStart":0},{"duration":548.7999999970198,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":375.6000000014901,"connectEnd":375.6000000014901,"connectStart":375.6000000014901,"domainLookupEnd":375.6000000014901,"domainLookupStart":375.6000000014901,"fetchStart":375.6000000014901,"redirectEnd":0,"redirectStart":0,"requestStart":375.6000000014901,"responseEnd":924.3999999985099,"responseStart":924.3999999985099,"secureConnectionStart":375.6000000014901},{"duration":1277.1999999955297,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":381.20000000298023,"connectEnd":381.20000000298023,"connectStart":381.20000000298023,"domainLookupEnd":381.20000000298023,"domainLookupStart":381.20000000298023,"fetchStart":381.20000000298023,"redirectEnd":0,"redirectStart":0,"requestStart":381.20000000298023,"responseEnd":1658.3999999985099,"responseStart":1658.3999999985099,"secureConnectionStart":381.20000000298023},{"duration":1277.2000000029802,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":382,"connectEnd":382,"connectStart":382,"domainLookupEnd":382,"domainLookupStart":382,"fetchStart":382,"redirectEnd":0,"redirectStart":0,"requestStart":382,"responseEnd":1659.2000000029802,"responseStart":1659.2000000029802,"secureConnectionStart":382},{"duration":390,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1032.7000000029802,"connectEnd":1032.7000000029802,"connectStart":1032.7000000029802,"domainLookupEnd":1032.7000000029802,"domainLookupStart":1032.7000000029802,"fetchStart":1032.7000000029802,"redirectEnd":0,"redirectStart":0,"requestStart":1032.7000000029802,"responseEnd":1422.7000000029802,"responseStart":1422.7000000029802,"secureConnectionStart":1032.7000000029802}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":165,"responseStart":368,"responseEnd":381,"domLoading":371,"domInteractive":1680,"domContentLoadedEventStart":1680,"domContentLoadedEventEnd":1722,"domComplete":2298,"loadEventStart":2298,"loadEventEnd":2299,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1662.2999999970198},{"name":"bigPipe.sidebar-id.end","time":1663.2000000029802},{"name":"bigPipe.activity-panel-pipe-id.start","time":1663.3999999985099},{"name":"bigPipe.activity-panel-pipe-id.end","time":1664.6000000014901},{"name":"activityTabFullyLoaded","time":1737.7000000029802}],"measures":[],"correlationId":"9708ffba9eb4bf","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":149,"dbReadsTimeInMs":14,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Implementing ALTER TABLE…DISABLE KEYS would require a change to the InnoDB data dictionary format, or maybe better to the data file format (MDEV-11658), to incidate that some indexes need to be rebuilt before they can be used.
Implementing ALTER TABLE…ENABLE KEYS would be somewhat tricky. I assume that it currently is a blocking operation, because neither MyISAM nor Aria support ALTER TABLE…ALGORITHM=INPLACE, LOCK=NONE. It might be best if the in-datafile index metadata records that I have envisioned in MDEV-11658 would be covered by undo log records. In that way, killing or backing up a server during such an operation should be manageable.