Concept of Cardinalilty in Oracle


As per wikipedia: Cardinality refers to uniquess of data:

In SQL (Structured Query Language), the term cardinality refers to the
uniqueness of data values contained in a particular column (attribute)
of a database table. The lower the cardinality, the more duplicated
elements in a column. Thus, a column with the lowest possible
cardinality would have the same value for every row. SQL databases use
cardinality to help determine the optimal query plan for a given

BUT, Oracle documentation explains it as:
"The cardinality is the estimated number of rows that will be returned by each operation"

So, is this term has different meaning in SQL and in Oracle ? or i am missing something here ?

Best Answer

The concept of cardinality does not change whether it is used in reference to the Oracle database or some other SQL database. Cardinality is the size of a set of some elements. From the mathematics point of view a set contains only distinct elements. When you reference values of a certain column as a set its cardinality is the number of unique values. When you reference rows returned by an operation they all comprise the result set (each has a unique row ID, to put it simply) and therefore the result set cardinality is the number of rows returned.