Query writing is art and it should be optimized. You will be worried about your sql query while handling millions of data. Here is the list should be avoided
1. Avoid using Not like,<>,Not IN
Not will always takes a huge query cost and it should be avoided in most cases.
2.Avoid using data conversion in where clause
ex: Where Convert(Varchar(25),country)=@country
3.Avoid using function call in where clause
ex:where country IN (dbo.getcountry(@country,'' , "))
4.Don't use SQL function (Max,Min,Sum) in sub query. it will eat time.
5.Avoid memory tabes (@temp),use temporary table (#temp)
List goes i will update whenever possible
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment