Parameterization Part 4: Non-Uniform Data Distribution

04/09/2014

This is the fourth post in the "Parameterization" series. In the previous post I wrote about parameter sniffing, and I mentioned that this method can be a good thing in some cases, but it can also be quite a bad thing in other cases. One case in which parameter sniffing is a bad thing is when the data in some column is distributed in a non-uniform way. For example, consider the "Status" column in the "Sales.Orders" table, which has a total of about 10M rows. This column has seven unique values with the following distribution: Status Number of Rows Open 314 Pending Approval 561 Approved 28,990 Paid 17,610 Shipped 817,197 Closed 7,922,834 Cancelled 1,032,886 If parameter sniffing...