Selectivity

Predicate: A predicate is a filtering conditions that selects a certain number of values from a value set. Example of a predicate may be : “age = 25” or “country = India”.

Selectivity represents a ratio of number of elements from a set that qualify a selection predicate.  Speaking reverse, the selectivity of predicate indicates how many rows from a row set will qualify the predicate.

selectivity

The selectivity is specified in percentage or in the value range 0.0 and 1.0. A selectivity of 0.0 indicates that no rows are qualified and a selectivity of 1.0 indicates that all rows are qualified. selectivity plays a major role in cost estimation logic. When a query has many filtering conditions, the selectivities of individual conditions have to be combined to get the resultant selectivity. This decided the resultant number of result rows.

Assume the total number of people is 200, out of which 20 people are Indian. So we can say the selectivity of (nationality = ‘Indian’) is 10% or 0.1. Similarly a selectivity of 30% or 0.3 will mean 60 people out of 200 people.