[MDEV-15824] innodb_defragment=ON trumps innodb_optimize_fulltext_only=ON in OPTIMIZE TABLE Created: 2018-04-09 Updated: 2018-06-05 Resolved: 2018-06-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.1.1, 10.2.0, 10.3.0 |
| Fix Version/s: | 10.1.34, 10.2.16, 10.3.8 |
| Type: | Bug | Priority: | Major |
| Reporter: | David Honig | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | optimize_table | ||
| Environment: |
rails, mariadb 10.2.13, debian |
||
| Issue Links: |
|
||||||||
| Description |
|
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;
show indexes in suggestions;
But!!! ALTER TABLE suggestions engine=InnoDB; 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. |
| Comments |
| Comment by Marko Mäkelä [ 2018-05-31 ] | ||
|
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? | ||
| Comment by David Honig [ 2018-05-31 ] | ||
|
I've tested even innodb_optimize_fulltext_only=0; but no change | ||
| Comment by Marko Mäkelä [ 2018-05-31 ] | ||
|
I had a look at the code.
It looks like it could make sense to allow innodb_optimize_fulltext_only=1 to take effect even if innodb_defragment=1 is set. I believe that defragmentation itself would not help on fulltext indexes. I would expect fts_optimize_table() to rebuild the inverted index so that deleted words no longer occur there. davidh, can you please try what happens if you do the following:
| ||
| Comment by David Honig [ 2018-06-04 ] | ||
|
Hi Marko, I've tried that. It works, but the thing is that I cannot say if it behaves the same way as before. We did rewrite our code completely since the issue came and now the table is just different Sorry | ||
| Comment by Marko Mäkelä [ 2018-06-05 ] | ||
|
Ever since I believe that the appropriate fix is to allow both parameters to take effect in OPTIMIZE TABLE, and to return HA_ADMIN_TRY_ALTER from ha_innobase::optimize() only when neither parameter is set, which is the default setting. |