Reputation: 325
I remember many years ago (YES, last 2006) that I stumbled upon a hidden or undocumented built-in function that computes the variability / variance of a column. This function was used when trying to determine if a column is good to put an index on. I remember reading that at SQL Server Central and it outputs something like
Column 1: 0.0291
Example would be if a column is boolean, where there are only 2 possible values it will output: 0.5
Or something like that
Now, I've searched for that function, I tried many google searches for weeks but I can't find it anymore.
Does anyone know what that function is?
Upvotes: 0
Views: 39
Reputation: 48482
I think what you are referring to is 'Cardinality', not variability. In any case it's an estimate of the number of distinct values in a column. I'm not aware of any function, hidden or otherwise, in SQL Server that will generate any sort of value for this, but the query plan generator certainly makes use of this when generating query plans. And you can see the results of that in the estimated query plan it generates in SSMS. The cardinality estimator has been greatly improved for SQL 2014 and you can read more about it here.
Upvotes: 1