0

I thought full-text search would let me do exact phrase searching in a more optimized way than a LIKE predicate, but I'm reading that it doesn't do that exactly.

Is "LIKE" the most efficient way to search thousands of rows of TEXT fields in a table for a literal string?

It's got to be exact matching...

4

3 回答 3

1

如果您在列上有正确的索引并且您只在值的开头查找“字符串”,LIKE(string%) 将更快地工作。如果“字符串”可能在您的值的中间,您必须使用 LIKE(%string%) ;在这种情况下会触发表扫描,而且速度很慢(主要比全文搜索慢)。您可以使用全文搜索的 CONTAINS() 函数进行精确匹配。

于 2009-04-08T21:00:46.993 回答
0

Apparently, CONTAINS is faster than a LIKE query...

http://www.docstoc.com/docs/2280727/Microsoft-SQL-Server-70-Full-Text-Search-What-is-full-text-search

(Profiling can be found on Page 19 of that presentation)

于 2009-04-08T20:30:25.037 回答
0

What version of SQL Server are you on? I would recommend replacing TEXT with VARCHAR(MAX), if you ever can (SQL Server 2005 and up).

What makes you say that full text won't work? How have you set up fulltext, and what do your fulltext queries look like?

Marc

于 2009-04-08T20:36:37.923 回答