This function returns the approximate number of distinct elements (without NULL).
- The result is not exact as it is with function COUNT, but it can be computed a lot faster.
- For the calculation, the algorithm HyperLogLog is used internally.
SELECT COUNT(DISTINCT customer_id) COUNT_EXACT,
APPROXIMATE_COUNT_DISTINCT (customer_id) COUNT_APPR
FROM orders WHERE price > 1000;