SARGable predicates include the following operators
=, >, >=, <, <=, IN, BETWEEN, and LIKE (in the case of prefix matching)
Non-SARGable operators include
NOT, NOT IN, <>, and LIKE
컬럼을 함수로 감싸지 않은것
1
2
3
4
5
6
7
8
Bad: Select ... WHERE isNull(FullName,'Ed Jones') = 'Ed Jones'
Fixed: Select ... WHERE ((FullName = 'Ed Jones') OR (FullName IS NULL))
Bad: Select ... WHERE SUBSTRING(DealerName,4) = 'Ford'
Fixed: Select ... WHERE DealerName Like 'Ford%'
Bad: Select ... WHERE DateDiff(mm,OrderDate,GetDate()) >= 30
Fixed: Select ... WHERE OrderDate < DateAdd(mm,-30,GetDate())