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
 Other SQL Server Topics (2005)
 Optimization in Search

Author  Topic 

deepak_Dotnet
Starting Member

32 Posts

Posted - 2007-04-30 : 05:17:09
Hi,
I have Search Critieria which makes use of "LIKE" statement to get records.THis is very simple search just making use of LIKE statment on two Columns of the table.

Example : SELECT ID from tblName WHERE ID LIKE '%PID_01%' AND LID LIKE '%CR_03%'

This works fine and also performace is also good when we have hundreds/thousandsof records.
But when records is of lakhs,i feel using LIKE statment will reduce the performance of our search Query.

SO how can we good performance in search ...?
I need to optimize my search which result good performace when we have lakhs of records ....?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-30 : 05:21:40
LIKE '%xx%' is going to hamper the performance when searching through large number of records because the Query Optimizer is unable to make use of index on the underlying columns.

You may get good performance by creating full-text index on the table and make use of predicates like CONTAINS to search for specific words.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -