Created
July 29, 2013 14:41
-
-
Save AlexArchive/6104780 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- In most cases, when you apply a manipulation on the filtered | |
-- column, SQL Server cannot use an index in an efficient manner: | |
SELECT orderid, custid, empid, orderdate | |
FROM Sales.Orders | |
WHERE YEAR(orderdate) = 2007 | |
-- To have the potentioal to use an index efficiently, you need | |
-- to revise the predicates so that there is no manipulation on | |
-- the filtered column: | |
SELECT orderid, custid, empid, orderdate | |
FROM Sales.Orders | |
WHERE orderdate BETWEEN '20070101' AND '20080101'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment