SQL Interview: 77 SARGability
This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.
Section: Development Level: Medium
Question:
A DBA at your site tells you that you need to make sure your predicates are sargable.
What is SARGability?
Assume a table has a column called OrderDate and it is of date data type. There is a single column index on the column. Can you give an example of a non-sargable predicate that uses it?
Answer:
SARGability determines if a query can take advantage of indexes efficiently, particularly for filtering conditions (e.g., in WHERE, JOIN ON, HAVING, etc.).
An example of a non-sargable predicate would be wrapping a function around the column before using it:
WHERE YEAR(OrderDate) = 2025
2025-09-09