top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

what is cardinality and what is selectivity in sql server

+3 votes
725 views
what is cardinality and what is selectivity in sql server
posted Jan 24, 2014 by Neeraj Pandey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

In SQL, cardinality refers to the number of unique values in particular column. So, cardinality is a numeric value that applies to a specific column inside a table.
In SQL, the term selectivity is used when discussing database indexes. The selectivity of a database index is a numeric value that is calculated using a specific formula. That formula actually uses the cardinality value to calculate the selectivity. This means that the selectivity is calculated using the cardinality – so the terms selectivity and cardinality are very much related to each other. Here is the formula used to calculated selectivity:
Formula to calculate selectivity:
Selectivity of index = cardinality/(number of rows) * 100%

answer Jan 26, 2014 by Prachi Agarwal
...