4

I've read in several articles that the density of a column is (1.0 / count(distinct columnname)). I have a column with roughly 2.6 million distinct values over 2.7 million rows, but the column density in DBCC show_statistics even AFTER updating statistics with fullscan is .48.

I am confused as to where this number could be coming from. Can anyone explain it to me?

  • 1
    Are you talking about the density in the STAT_HEADER? BOL Says this isn't used anyway – Martin Smith Oct 29 '13 at 18:25
  • 2
    BOL says it's not used for 2008 and higher. I'm on an '05 instance. But yes that's what I meant. I think maybe I mistook what that value meant? – Aushin Oct 29 '13 at 18:32
5

The documentation for DBCC SHOW_STATISTICS says that Density (in the header) is:

Calculated as 1 / distinct values for all values in the first key column of the statistics object, excluding the histogram boundary values.

It also says:

This Density value is not used by the query optimizer and is displayed for backward compatibility with versions before SQL Server 2008.

You are using SQL Server 2005, so this value may be relevant to you in some circumstances, but I don't know exactly when 2005 would use that Density value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.