Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Is it useful to index on a description field?

Author  Topic 

mtl777
Yak Posting Veteran

63 Posts

Posted - 2009-05-26 : 15:03:53
I have an application where a Description column sees quite heavy use in queries but the usage is with the LIKE operator, e.g., WHERE Description LIKE '%sauce%'. Is it any use at all to index on the Description column? I'm thinking it may not be useful because SQL Server may be unable to do a binary tree approach for this kind of search. Any thoughts?

Thanks!

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-05-26 : 16:20:29
A wildcard search beginning with % will not use an index.
It has to scan the table because the value you are looking for will not be part of the index anyway.


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

mtl777
Yak Posting Veteran

63 Posts

Posted - 2009-05-26 : 18:24:46
Thank you so much! I'm learning a lot from this forum.
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2009-05-26 : 19:37:55
For this type of search, you should look at full text indexing.


CODO ERGO SUM
Go to Top of Page
   

- Advertisement -