How the Statistics Histogram Is Used

The histogram steps are used for SARGs only when a constant expression is compared against an indexed column and the value of the constant expression can be determined at query compile time. The following SARG examples show where histogram steps can be used:

Image where col_a = getdate()

Image where cust_id= 12345

Image where monthly_sales < 10000 / 12

where LastName like "Smith" + "%"

Some constant expressions cannot be evaluated ...

Get Microsoft® SQL Server 2012 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.