Cardinality is the estimated number of rows the step will return. cost is the estimated amount of work the plan will do. A higher cardinality => you're going to fetch more rows => you're going to do more work => the query will take longer. Thus the cost is (usually) higher.
Selectivity = No. of rows returning from the query / total no of rows
i.e. Selectivity = (select * from table where rownum<40) / select * from table
Cardinality = total no of rows * Selectivity
No comments:
Post a Comment