How can I optimize/refactor a TSQL “LIKE” clause?

前端 未结 7 749
野的像风
野的像风 2020-12-10 04:50

I have a table with 117000 or so records. I need to perform a search that checks 3 separate fields for a given string pattern.

My where clause is as follows:

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-10 05:42

    Use Full Text Search and CONTAINS. LIKE cannot be optimized when searching in the middle of the field, ie. when the LIKE expression starts with an '%', so it will always do a full table scan.

提交回复
热议问题