mysql像性能提升 [英] mysql like performance boost
问题描述
如果涉及通配符,是否仍可以像操作员一样加快mysql的运行速度?例如.就像%test%"
is there anyway to speed up mysql like operator performance if wild card is involved? eg. like '%test%'
推荐答案
如果查询看起来像foo LIKE 'abc%'
或foo LIKE 'abc%def%'
,MySQL可以使用索引.它可以将索引用于第一个通配符之前的任何部分或字符串.如果需要在字符串中的任意位置匹配单词,则可能需要考虑使用FULLTEXT
索引.
MySQL can use an index if your query looks like foo LIKE 'abc%'
or foo LIKE 'abc%def%'
. It can use the index for any portion or the string before the first wildcard. If you need to match a word anywhere within a string, you might want to consider using FULLTEXT
indexes instead.
有关索引的更多详细信息: http://dev.mysql .com/doc/refman/5.1/en/mysql-indexes.html
More detail on indexes: http://dev.mysql.com/doc/refman/5.1/en/mysql-indexes.html
全文搜索: http://dev.mysql. com/doc/refman/5.0/en/fulltext-search.html
这篇关于mysql像性能提升的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!