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":1002.8999996185303,"ttfb":300.5,"pageVisibility":"visible","entityId":66742,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"73278e44-1156-495b-a570-800b601b6aca","navigationType":0,"readyForUser":1085.2999997138977,"redirectCount":0,"resourceLoadedEnd":1123,"resourceLoadedStart":307.5,"resourceTiming":[{"duration":218.39999961853027,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":307.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":307.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":525.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":218.5,"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":307.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":307.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":526.2999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":229.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":308,"connectEnd":308,"connectStart":308,"domainLookupEnd":308,"domainLookupStart":308,"fetchStart":308,"redirectEnd":0,"redirectStart":0,"requestStart":308,"responseEnd":537.2999997138977,"responseStart":537.2999997138977,"secureConnectionStart":308},{"duration":290,"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":308.09999990463257,"connectEnd":308.09999990463257,"connectStart":308.09999990463257,"domainLookupEnd":308.09999990463257,"domainLookupStart":308.09999990463257,"fetchStart":308.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":308.09999990463257,"responseEnd":598.0999999046326,"responseStart":598.0999999046326,"secureConnectionStart":308.09999990463257},{"duration":293.5,"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":308.3999996185303,"connectEnd":308.3999996185303,"connectStart":308.3999996185303,"domainLookupEnd":308.3999996185303,"domainLookupStart":308.3999996185303,"fetchStart":308.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":308.3999996185303,"responseEnd":601.8999996185303,"responseStart":601.8999996185303,"secureConnectionStart":308.3999996185303},{"duration":293.8999996185303,"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":308.5,"connectEnd":308.5,"connectStart":308.5,"domainLookupEnd":308.5,"domainLookupStart":308.5,"fetchStart":308.5,"redirectEnd":0,"redirectStart":0,"requestStart":308.5,"responseEnd":602.3999996185303,"responseStart":602.3999996185303,"secureConnectionStart":308.5},{"duration":294.2000002861023,"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":308.7999997138977,"connectEnd":308.7999997138977,"connectStart":308.7999997138977,"domainLookupEnd":308.7999997138977,"domainLookupStart":308.7999997138977,"fetchStart":308.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":308.7999997138977,"responseEnd":603,"responseStart":603,"secureConnectionStart":308.7999997138977},{"duration":375.30000019073486,"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":308.8999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":308.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":684.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":294.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":309.09999990463257,"connectEnd":309.09999990463257,"connectStart":309.09999990463257,"domainLookupEnd":309.09999990463257,"domainLookupStart":309.09999990463257,"fetchStart":309.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":309.09999990463257,"responseEnd":603.5,"responseStart":603.5,"secureConnectionStart":309.09999990463257},{"duration":375.09999990463257,"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":309.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":309.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":684.2999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":294.7000002861023,"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":309.3999996185303,"connectEnd":309.3999996185303,"connectStart":309.3999996185303,"domainLookupEnd":309.3999996185303,"domainLookupStart":309.3999996185303,"fetchStart":309.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":309.3999996185303,"responseEnd":604.0999999046326,"responseStart":604.0999999046326,"secureConnectionStart":309.3999996185303},{"duration":807.2000002861023,"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":314.7999997138977,"connectEnd":314.7999997138977,"connectStart":314.7999997138977,"domainLookupEnd":314.7999997138977,"domainLookupStart":314.7999997138977,"fetchStart":314.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":314.7999997138977,"responseEnd":1122,"responseStart":1122,"secureConnectionStart":314.7999997138977},{"duration":808.2000002861023,"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":314.7999997138977,"connectEnd":314.7999997138977,"connectStart":314.7999997138977,"domainLookupEnd":314.7999997138977,"domainLookupStart":314.7999997138977,"fetchStart":314.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":314.7999997138977,"responseEnd":1123,"responseStart":1123,"secureConnectionStart":314.7999997138977},{"duration":373.19999980926514,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":696.1999998092651,"connectEnd":696.1999998092651,"connectStart":696.1999998092651,"domainLookupEnd":696.1999998092651,"domainLookupStart":696.1999998092651,"fetchStart":696.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":696.1999998092651,"responseEnd":1069.3999996185303,"responseStart":1069.3999996185303,"secureConnectionStart":696.1999998092651},{"duration":158.59999990463257,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":996.5999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":996.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1155.1999998092651,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":110,"responseStart":300,"responseEnd":308,"domLoading":305,"domInteractive":1211,"domContentLoadedEventStart":1211,"domContentLoadedEventEnd":1255,"domComplete":2186,"loadEventStart":2186,"loadEventEnd":2188,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1175.7999997138977},{"name":"bigPipe.sidebar-id.end","time":1176.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1176.6999998092651},{"name":"bigPipe.activity-panel-pipe-id.end","time":1180.6999998092651},{"name":"activityTabFullyLoaded","time":1300.3999996185303}],"measures":[],"correlationId":"8b2f8065064965","effectiveType":"4g","downlink":9.6,"rtt":0,"serverDuration":132,"dbReadsTimeInMs":12,"dbConnsTimeInMs":22,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}