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.
Author |
Topic |
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2012-04-20 : 14:06:41
|
how do i rewrite the below to improve the performance..delete from Test.dbo.Student WHERE VAL LIKE '%JOIN%' and VAL NOT LIKE '%;%;%' delete from Test.dbo.Student WHERE VAL LIKE '%Completed%' and VAL NOT LIKE '%;%;%;%' |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-20 : 15:06:32
|
Queries seraching for patterns like this wont perform well. Can I ask what exactly you're trying to detect using above conditions?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2012-04-20 : 16:15:04
|
There is no index defined on the table howerver the val is varchar type.Would it improve the performance if the index is created.. |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2012-04-20 : 16:38:21
|
Unlikely. Leading wildcard patterns cannot use an index for a seek, at best it would have to scan the index. |
 |
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2012-04-20 : 17:12:25
|
Thanks What is possible solution to my query for performance.. |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2012-04-20 : 17:46:51
|
It's hard to say. Full-text indexing can help find words, but will ignore punctuation. What are you storing in that column? |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-21 : 13:15:55
|
quote: Originally posted by sqlfresher2k7 Thanks What is possible solution to my query for performance..
You didnt answer my questionwhat is the purpose of used query?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|