When should you use full-text indexing?

前端 未结 4 642
孤独总比滥情好
孤独总比滥情好 2020-12-08 06:18

We have a whole bunch of queries that \"search\" for clients, customers, etc. You can search by first name, email, etc. We\'re using LIKE statements in the following manner:

4条回答
  •  没有蜡笔的小新
    2020-12-08 07:09

    To answer the question specifically for MSSQL, full-text indexing will NOT help in your scenario.

    In order to improve that query you could do one of the following:

    1. Configure a full-text catalog on the column and use the CONTAINS() function.
    2. If you were primarily searching with a prefix (i.e. matching from the start of the name), you could change the predicate to the following and create an index over the column.

      where fname like 'prefix%'

    (1) is probably overkill for this, unless the performance of the query is a big problem.

提交回复
热议问题