if you are using fulltext indexes in mysql and plan to switch from myisam to innodb then you should review the reference manual section onfine-tuning mysql full-text searchto see what configuration changes may be required. as i mentioned inyesterday’s postwhen comparing query results on my database with fulltext indexes in myisam versus innodb i got different results. specifically, the innodb tables were returning fewer results for certain queries with short fulltext search terms. here’s an example of a query that returned fewer results on innodb:
<code>select idfrom flite.ad_indexwhere match(name,description,keywords) against('+v1*' IN BOOLEAN MODE);</code>登录后复制 |
The issue was that all of the fine tuning I had done before was limited to MyISAM, so it didn’t affect InnoDB. In the past I configured MySQL FULLTEXT search to index words as short as 1 character (the default is 3), and to index common words (not to use any stopword list). These are the relevant variables I set in in my.cnf:
<code>ft_min_word_len = 1ft_stopword_file = ''</code> 登录后复制 |
InnoDB has its own variables to control stopwords and minimum word length, so I needed to set these variables when I changed the tables from MyISAM to InnoDB:
<code>innodb_ft_min_token_size = 1innodb_ft_enable_stopword = OFF</code> 登录后复制 |
Since those variables are not dynamic, I had to restart MySQL for them to take effect. Furthermore, I needed to rebuild the FULLTEXT indexes on the relevant tables. This is howthe manualinstructs you to rebuld the indexes:
To rebuild the FULLTEXT indexes for an InnoDB table, use ALTER TABLE with the DROP INDEX and ADD INDEX options to drop and re-create each index.
Rather than drop and recreate the indexes, I just usedALTER TABLE ... FORCEto rebuild the table (and indexes), like this:
<code>alter table flite.ad_index force;</code> 登录后复制 |
After making those changes I re-ranpt-upgrade, and now I am getting the same set of rows back from MyISAM and InnoDB. The order of the rows is slightly different in some cases, but as I mentioned yesterday that isexpected behavior.
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号