SQL Server索引-LIKE查询有任何改进吗? [英] SQL Server Index - Any improvement for LIKE queries?
问题描述
我们有一个查询,该查询运行于一个相当大的表上,不幸的是,该表需要在几个varchar字段上使用LIKE'%ABC%',以便用户可以搜索部分名称等.SQLServer 2005
We have a query that runs off a fairly large table that unfortunately needs to use LIKE '%ABC%' on a couple varchar fields so the user can search on partial names, etc. SQL Server 2005
在使用LIKE时,在这些varchar字段上添加索引是否对选择查询性能有帮助?或者在这种情况下,它基本上会忽略索引并进行完整扫描吗?
Would adding an index on these varchar fields help any in terms of select query performance when using LIKE or does it basically ignore the indexes and do a full scan in those cases?
使用LIKE时还有其他提高性能的方法吗?
Any other possible ways to improve performance when using LIKE?
推荐答案
仅当您向这些列添加全文搜索并使用SQL Server的全文查询功能时.
Only if you add full-text searching to those columns, and use the full-text query capabilities of SQL Server.
否则,不行,索引将无济于事.
Otherwise, no, an index will not help.
这篇关于SQL Server索引-LIKE查询有任何改进吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!