Custom Statistics Distributions in SQL Server 2022


Statistics are important for the query processing engine in SQL Server to run efficiently. The type of execution plan that is created often depends on the optimizer knowing the distribution of data in a column. This is why so many of us have maintenance jobs that update statistics, even with auto-update statistics turned on.

Until now, we’ve been limited to a single histogram for all columns, with the same shape and size, or at least, the same maximum 200 steps.  We’ve also been limited to a single column when there are multiple key columns. This post will show you how