Tuesday, November 3, 2009

Dave's Stuff: Cardinality

Here's some good stuff on cardinality I read recently. It made me think to review my own understanding of the computation of cardinality in a table. Dave's Stuff: Cardinality

I didn't know that cardinality isn't a perfect computation of cardinality, rather a random sampling of values during an ANALYZE TABLE according to his description.

Dave - The way I have been explaining cardinality to users is to discuss uniqueness of a value. If a bin has n items in it, the highest cardinality possible is n if all the items in the bin are unique. The lowest possible cardinality is 1. The real value of cardinality is the relationship of the number of all items in the bin to the number of distinct items in the bin (key in this case). One formula for determining this is...

cardinality = total_items / distinct_items