Tuesday, September 22, 2009

Selectivity and Cardinality

In performance tuning, understanding key concept of selectivity and cardinality are very important.

According to the Chris Antognini:

Selectivity is the value between 0 and 1, and it is the fraction of rows returned after applying a filter on the table. For example if a table has 10,000 rows and the query returns 2601 rows, the the selectivity would be 2601/10000 or .26 or 26 percent. Selectivity enables you (or optimizer for that matter) to decide which data access method is optimum in the execution plan.

Cardinality is the number of rows returnd by an operation on the table.

No comments: