mysql like performance boost

后端 未结 2 858
终归单人心
终归单人心 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:28

    Well, the simplest optimization would be to have a constant prefix (e.g. "test%" instead of "%test" or "%test%") since that would allow the engine to narrow down the search space using indices. However, that is not possible in all situations.

    Sometimes a preprocessing step can turn a wildcard search into an ordinary equality or a fulltext search. You'll gain more by finding a way to structure your data so that it does not require a wildcard search than trying to optimize the latter.

提交回复
热议问题