Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Performance question Expand / Collapse
Author
Message
Posted Monday, October 29, 2012 1:10 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 12:00 PM
Points: 298, Visits: 1,090
Would there be any slowness in performance if a query involves dateadd(day,datediff(day,1,GETDATE()),0) in the WHERE clause?
Post #1378430
Posted Monday, October 29, 2012 1:33 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 10:01 AM
Points: 13,121, Visits: 11,954
sunny.tjk (10/29/2012)
Would there be any slowness in performance if a query involves dateadd(day,datediff(day,1,GETDATE()),0) in the WHERE clause?


There of course is some impact to performance but it is actually pretty minimal in this case. The reason the performance impact it minimal is because this is a calculated value, not a value that will change row by row. In other words this will have no impact on index usage/SARGability. I hope that answers your question.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1378441
Posted Tuesday, October 30, 2012 7:38 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 12:00 PM
Points: 298, Visits: 1,090
Sean Lange (10/29/2012)
sunny.tjk (10/29/2012)
Would there be any slowness in performance if a query involves dateadd(day,datediff(day,1,GETDATE()),0) in the WHERE clause?


There of course is some impact to performance but it is actually pretty minimal in this case. The reason the performance impact it minimal is because this is a calculated value, not a value that will change row by row. In other words this will have no impact on index usage/SARGability. I hope that answers your question.


That answers my question. Thanks Sean.
Post #1378774
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse