1.0 - 8.00 - Approximate Cardinality - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Teradata Vantage
Release Number
Release Date
May 2019
Content Type
Programming Reference
Publication ID
English (United States)

The Approximate Cardinality function, which is composed of the ApproxCardinalityReduce and ApproxCardinalityMap functions, can estimate the cardinality (number of distinct values) in a column or combination of columns, scanning the table only once.

Teradata recommends this function when the column or combination of columns has a large cardinality. The function can estimate the number of distinct values much faster than the SQL SELECT DISTINCT command can return the precise number of distinct values.

When the cardinality is small, Teradata recommends the SQL SELECT DISTINCT command.

The function uses the Flajolet-Martin algorithm. For more information, see Probabilistic Counting Algorithms for Data Base Applications, by Philippe Flajolet and G. Nigel Martin (http://portal.acm.org/citation.cfm?id=5215).