The paper "How good are query optimizers, really?" says that cardinality is the thing that most influence to find a better query execution plan in RDBMS. Summary of this paper can be found here. However, other posts that explain the difference between cardinality and selectivity point that selectivity is more important.
Example:
select max(price) from tickets where country = ‘CANADA’;
Let us say we have a table: tickets with 180 rows. Based on the above example, there are 10 rows in the table for country = ‘CANADA’. The query returns only one row, the max(price). selectivity = ? cardinality = ?
selectivity = number of rows accessed/total number of rows = 10/180 = 0.05 (5% of the rows were accessed) cardinality = number of rows accessed = 10
My opinion is that selectivity is only found once we have the cardinality, therefore cardinality remains the more important thing to find the best query execution plan. What do you think? Could you please answer with a detail explanation about your understanding? Thanks