Monday, 11 August 2025

Estimating the Number of Distinct Values

Normal method to get the distinct values,

    SELECT COUNT(DISTINCT(customer_name)) FROM table_name;

Using estimation function,

    SELECT HLL(customer_name) FROM table_name;


Benchmark: For 150,000,000 rows

  •     Normal method took, 12s
  •     Estimation function took, 5.6s

No comments:

Snowflake - Cost Optimization

Reduce auto-suspend to 60 seconds Reduce virtual warehouse size Ensure minimum clusters are set to 1 Consolidate warehouses Separate warehou...