SQL Server Query Performance Tuning
- February 8, 2017
- Posted by: Bharat Patel
- Category: Uncategorized
			No Comments 
		
	Try to avoid function (user defined or inbuild) in where condition of sql query as it is always overlook indexing created on tables and taking much longer time to execute in case of table having large number of rows (over million)
Have a look below query. How to avoid date range condition? I hope it may be helpful to you.
Query 1 : convert(date, getDate())
[code:sql]
SELECT * FROM xyz
WHERE convert(date, getDate()) = ‘2011-05-09’
[/code]
Query 2 : Fixed with differnt way
[code:sql]
SELECT * FROM xyz
WHERE createddate >= ‘2011-05-09’
AND createddate < dateAdd(d,1,’2011-05-09′)
[/code]
 
						 
					 sales@isummation.com
 sales@isummation.com
 +1 302 202 3260
 +1 302 202 3260 
