Working with DATES in a SARGABLE way ...and gofast! ...All clearly explained!
Hi Guys, Welcome to this new post! We have already spoken many times about sargability . For example here: Write high performing query: Is your query SARGABLE? SQL Server queries, write them Sargable: the ISNULL function https://sqlserverperformace.blogspot.com/2019/11/sargable-queries-part-2-examples.html Sargability is the key factor to having a performant query but talking about dates is not always easy to get this property . Today we will see how to turn a non sargable query using dates into a sargable one . Obviously the difference in performance is really remarkable! Enjoy! Working with dates in a sargable way Sargability is a great property! We can say that a query is sargable when its WHERE clause can use index in seek mode . I suggest you read my other posts where I tell you why often the queries are not sargable. For example when I use a function, but there are other cases.. And often when we handle dates we use functions. Who has never used the date...