Understanding predicate SARGability

A predicate is a filter that can be used to determine the set of conditions to apply to a query in order to trim the result set. As we have discussed in previous chapters, these are typically applicable to the following clauses:

  • JOIN clauses, which filter rows matching the type of join
  • HAVING clauses, which filter the results
  • WHERE clauses, which filter source rows from a table or an index

Most queries will make use of predicates, usually through a WHERE clause. When a predicate is serviceable by an index, it is said the predicate is SARGable, which is an acronym for Search ARGument-able. Having SARGable predicates should be a goal for our T-SQL queries, because it can reduce the number of rows which ...

Get Learn T-SQL Querying now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.