mysql like performance boost

后端 未结 2 853
终归单人心
终归单人心 2020-11-28 12:36

is there anyway to speed up mysql like operator performance if wild card is involved? eg. like \'%test%\'

2条回答
  •  暖寄归人
    2020-11-28 13:13

    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.

    More detail on indexes: http://dev.mysql.com/doc/refman/5.1/en/mysql-indexes.html

    Full text search: http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html

提交回复
热议问题