Warehouse fact-dimension joins

DesignHard45 minSnowflake and Databricks style

Your task

An MPP warehouse (Redshift/Snowflake/BigQuery-style) backs analytics for a retailer: a ~10B-row fact_sales, a 200M-row dim_customer, and a small dim_store. Analysts complain that joins between sales and customer are slow and that some queries hammer a few compute nodes while others sit idle. A handful of mega-customers (marketplace resellers) account for a huge fraction of rows. Design the physical layout, distribution/partitioning/clustering and join strategy, so the big fact↔dimension joins are fast and load is balanced.

It covers

  • Distribution keys
  • Query performance
  • Skew