FreeText Query is slow - includes TOP and Order By

前端 未结 6 1432
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-13 15:03

The Product table has 700K records in it. The query:

SELECT TOP 1 ID, Name FROM Product WHERE contains(Name, \'\"White Dress\"\') ORDER BY DateMadeN

6条回答
  •  醉话见心
    2021-01-13 15:43

    I had the same problem earlier.

    The performance depends on which unique index you choose for full text indexing. My table has two unique columns - ID and article_number.

    The query:

    select top 50 id, article_number, name, ... 
    from ARTICLE 
    CONTAINS(*,'"BLACK*" AND "WHITE*"')
    ORDER BY ARTICLE_NUMBER
    

    If the full text index is connected to ID then it is slow depending on the searched words. If the full text index is connected to ARTICLE_NUMBER UNIQUE index then it was always fast.

提交回复
热议问题