When using inplace defragmentation from Facebook/Kakao defragmentation patch the tables are not causing errors due to the locks. But we do have a so called 'suggestions' table previously used as full text index purposes. This table has a lot of records exchanged every night. When we use inplace defragmentation with OPTIMIZE TABLE, or OPTIMIZE LOCAL TABLE it works fast and fine, but the search gets slower and slower.
DESCRIBE suggestions;
Field |
Type |
Null |
Key |
Default |
Extra |
id |
int(11) |
NO |
PRI |
NULL |
auto_increment |
record_type |
varchar(30) |
YES |
MUL |
NULL |
|
record_id |
int(11) |
YES |
MUL |
NULL |
|
tokens |
text |
YES |
MUL |
NULL |
|
ts |
datetime |
NO |
MUL |
0000-00-00 00:00:00 |
|
show indexes in suggestions;
Table |
Non_unique |
Key_name |
Seq_in_index |
Column_name |
Collation |
Cardinality |
Sub_part |
Packed |
Null |
Index_type |
Comment |
Index_comment |
suggestions |
0 |
PRIMARY |
1 |
id |
A |
233197 |
NULL |
NULL |
|
BTREE |
|
|
suggestions |
0 |
index_suggestions_on_record_type_and_record_id |
1 |
record_type |
A |
2 |
NULL |
NULL |
YES |
BTREE |
|
|
suggestions |
0 |
index_suggestions_on_record_type_and_record_id |
2 |
record_id |
A |
233197 |
NULL |
NULL |
YES |
BTREE |
|
|
suggestions |
1 |
index_suggestions_on_ts |
1 |
ts |
A |
2429 |
NULL |
NULL |
|
BTREE |
|
|
suggestions |
1 |
index_suggestions_on_record_id |
1 |
record_id |
A |
233197 |
NULL |
NULL |
YES |
BTREE |
|
|
suggestions |
1 |
tokens |
1 |
tokens |
NULL |
NULL |
NULL |
NULL |
YES |
FULLTEXT |
|
|
But!!!
ALTER TABLE suggestions engine=InnoDB;
uses tmp table to resort
Query OK, 248078 rows affected (10.53 sec)
Records: 248078 Duplicates: 0 Warnings: 0
SELECT * FROM `suggestions` WHERE (MATCH(suggestions.tokens) AGAINST ('foobar' IN BOOLEAN MODE)) LIMIT 15 OFFSET 0;
Empty set (0.00 sec) <---------------------
Why OPTIMIZE TABLE does not end with the same performace as ALTER TABLE syntax? What should be performed to make the performace the same? It is brilliant to do defrag inplace, but the performace is the same as not doing it at all.
- is caused by
-
MDEV-5834
Merge Kakao Defragmentation implementation to MariaDB 10.1
-
-
Closed
{"report":{"fcp":949.5999999046326,"ttfb":231,"pageVisibility":"visible","entityId":66742,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"a65e8f15-d06f-4cd8-961d-dd2c15b1d919","navigationType":0,"readyForUser":1037.1999998092651,"redirectCount":0,"resourceLoadedEnd":1255.7999997138977,"resourceLoadedStart":236.7999997138977,"resourceTiming":[{"duration":177.2000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":236.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":236.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":414,"responseStart":0,"secureConnectionStart":0},{"duration":177.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":237.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":237.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":414.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":186.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":237.2999997138977,"connectEnd":237.2999997138977,"connectStart":237.2999997138977,"domainLookupEnd":237.2999997138977,"domainLookupStart":237.2999997138977,"fetchStart":237.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":237.2999997138977,"responseEnd":423.59999990463257,"responseStart":423.59999990463257,"secureConnectionStart":237.2999997138977},{"duration":247.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":237.40000009536743,"connectEnd":237.40000009536743,"connectStart":237.40000009536743,"domainLookupEnd":237.40000009536743,"domainLookupStart":237.40000009536743,"fetchStart":237.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":237.40000009536743,"responseEnd":484.69999980926514,"responseStart":484.69999980926514,"secureConnectionStart":237.40000009536743},{"duration":251.7000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":237.69999980926514,"connectEnd":237.69999980926514,"connectStart":237.69999980926514,"domainLookupEnd":237.69999980926514,"domainLookupStart":237.69999980926514,"fetchStart":237.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":237.69999980926514,"responseEnd":489.40000009536743,"responseStart":489.40000009536743,"secureConnectionStart":237.69999980926514},{"duration":252.2000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":237.7999997138977,"connectEnd":237.7999997138977,"connectStart":237.7999997138977,"domainLookupEnd":237.7999997138977,"domainLookupStart":237.7999997138977,"fetchStart":237.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":237.7999997138977,"responseEnd":490,"responseStart":490,"secureConnectionStart":237.7999997138977},{"duration":252.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":238,"connectEnd":238,"connectStart":238,"domainLookupEnd":238,"domainLookupStart":238,"fetchStart":238,"redirectEnd":0,"redirectStart":0,"requestStart":238,"responseEnd":490.5,"responseStart":490.5,"secureConnectionStart":238},{"duration":332.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":238.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":238.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":570.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":252.60000038146973,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":238.2999997138977,"connectEnd":238.2999997138977,"connectStart":238.2999997138977,"domainLookupEnd":238.2999997138977,"domainLookupStart":238.2999997138977,"fetchStart":238.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":238.2999997138977,"responseEnd":490.90000009536743,"responseStart":490.90000009536743,"secureConnectionStart":238.2999997138977},{"duration":332.3999996185303,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":238.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":238.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":570.7999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":253.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":238.59999990463257,"connectEnd":238.59999990463257,"connectStart":238.59999990463257,"domainLookupEnd":238.59999990463257,"domainLookupStart":238.59999990463257,"fetchStart":238.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":238.59999990463257,"responseEnd":491.7999997138977,"responseStart":491.7999997138977,"secureConnectionStart":238.59999990463257},{"duration":1015.6999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":239.59999990463257,"connectEnd":239.59999990463257,"connectStart":239.59999990463257,"domainLookupEnd":239.59999990463257,"domainLookupStart":239.59999990463257,"fetchStart":239.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":239.59999990463257,"responseEnd":1255.2999997138977,"responseStart":1255.2999997138977,"secureConnectionStart":239.59999990463257},{"duration":1011.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":244.2999997138977,"connectEnd":244.2999997138977,"connectStart":244.2999997138977,"domainLookupEnd":244.2999997138977,"domainLookupStart":244.2999997138977,"fetchStart":244.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":244.2999997138977,"responseEnd":1255.7999997138977,"responseStart":1255.7999997138977,"secureConnectionStart":244.2999997138977},{"duration":247.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":582.9000000953674,"connectEnd":582.9000000953674,"connectStart":582.9000000953674,"domainLookupEnd":582.9000000953674,"domainLookupStart":582.9000000953674,"fetchStart":582.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":582.9000000953674,"responseEnd":830.4000000953674,"responseStart":830.4000000953674,"secureConnectionStart":582.9000000953674},{"duration":446.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":891.5999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":891.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1338.2999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":414.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":892.5999999046326,"connectEnd":892.5999999046326,"connectStart":892.5999999046326,"domainLookupEnd":892.5999999046326,"domainLookupStart":892.5999999046326,"fetchStart":892.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":892.5999999046326,"responseEnd":1307.4000000953674,"responseStart":1307.4000000953674,"secureConnectionStart":892.5999999046326},{"duration":420.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":893.0999999046326,"connectEnd":893.0999999046326,"connectStart":893.0999999046326,"domainLookupEnd":893.0999999046326,"domainLookupStart":893.0999999046326,"fetchStart":893.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":893.0999999046326,"responseEnd":1313.7999997138977,"responseStart":1313.7999997138977,"secureConnectionStart":893.0999999046326},{"duration":403.7000002861023,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":936.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":936.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1340,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":43,"responseStart":231,"responseEnd":239,"domLoading":235,"domInteractive":1291,"domContentLoadedEventStart":1291,"domContentLoadedEventEnd":1338,"domComplete":1956,"loadEventStart":1956,"loadEventEnd":1957,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1260.0999999046326},{"name":"bigPipe.sidebar-id.end","time":1261.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1261.2999997138977},{"name":"bigPipe.activity-panel-pipe-id.end","time":1263.7999997138977},{"name":"activityTabFullyLoaded","time":1357.4000000953674}],"measures":[],"correlationId":"76e04f97101267","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":124,"dbReadsTimeInMs":11,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Are you using non-default values of either of these flags?
If yes, then OPTIMIZE should report OK. Normally, it reports that InnoDB does not support OPTIMIZE, but it will rebuild the table instead.
Can you confirm whether this is the case?