← Snowflake Interview Insights

Snowflake·Data Scientist·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
May 2026

Summary

This was a deep technical design round for a Data Scientist role at Snowflake, basically a full system design session focused on analytics infrastructure at scale. Four sub-questions, all interconnected, and the level of DDL and SQL detail expected was way higher than I anticipated.

Questions Asked (4)

Q1

Design a fact and dimension table schema for a warehouse handling 50M events per day. Include DDL-level details: partitioning, clustering keys, surrogate keys, and how you'd handle slowly changing dimensions for user country and app version.

Data ModelingSystem DesignTechnical Trade-offs
Author's notes

I knew Type 2 SCDs conceptually but fumbled when they asked me to actually write the DDL on the spot.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the business processes and grain of the fact table, then design a star schema with a central fact table and dimensions. For the fact table, propose partitioning by date and clustering by high-cardinality columns like user_id or event_type to optimize query performance. For slowly changing dimensions, use Type 2 for user country and app version to track historical changes, and explain how surrogate keys and effective dates enable point-in-time analysis.

Pro tip: Mention that in Snowflake, clustering keys are not like traditional indexes and incur costs, so choose them based on common query filters and consider using automatic clustering for large tables. Also, highlight that Type 2 SCDs can be implemented efficiently using streams and tasks for change data capture.

1. Clarify Requirements and Grain

Ask about the specific events, dimensions, and queries to determine the fact table grain (e.g., one row per event) and identify key dimensions like user, app, and time.

2. Design Fact Table

Propose a fact table with surrogate keys for dimensions, degenerate dimensions (e.g., event_id), and measures. Specify partitioning by date (e.g., event_date) and clustering by columns like user_id or event_type for query performance.

3. Design Dimension Tables

Create dimension tables for user, app, and date. For user and app dimensions, include surrogate keys, natural keys, and attributes. For SCDs, add effective_start_date, effective_end_date, and is_current flags.

4. Handle Slowly Changing Dimensions

For user country and app version, implement Type 2 SCDs to track historical changes. Explain how surrogate keys are generated and how to join fact tables to dimensions for point-in-time analysis.

5. Discuss Trade-offs and Snowflake Specifics

Address trade-offs between Type 1 and Type 2 SCDs, and mention Snowflake features like clustering keys, automatic clustering, and streams/tasks for SCD management.

Key Points to Mention

  • Star schema design with fact and dimension tables
  • Partitioning by date and clustering by high-cardinality columns
  • Surrogate keys for dimensions and fact table
  • Type 2 slowly changing dimensions for user country and app version
  • Snowflake-specific features: clustering keys, automatic clustering, streams and tasks
  • Trade-offs between query performance, storage cost, and complexity

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Events can arrive up to 14 days late and out of order, with occasional duplicates on the same (user_id, event_ts, event_type) combination. What's your deduplication key and upsert strategy, and how do you handle late data reprocessing without double-counting cohorts? Include a backfill plan.

Data ModelingSystem DesignTechnical Trade-offs
Author's notes

This is where I spent most of my mental energy.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining a deterministic deduplication key that includes user_id, event_ts, and event_type, then propose an idempotent upsert strategy using MERGE or INSERT ON CONFLICT. Explain how to handle late data by reprocessing affected partitions and using a deduplicated source of truth to avoid double-counting cohorts. Finally, outline a backfill plan that includes validation and monitoring.

Pro tip: Emphasize that deduplication should happen at the earliest possible stage (e.g., in the ingestion pipeline) to minimize downstream complexity and cost. Also, mention that using a combination of event_ts and ingestion_ts can help distinguish between late-arriving data and duplicates.

1. Define Deduplication Key

Use a composite key of (user_id, event_ts, event_type) as the primary deduplication key. Optionally, include an event_id if available, but fall back to the composite key when not.

2. Choose Upsert Strategy

Implement an idempotent upsert using MERGE (Snowflake) or INSERT ON CONFLICT (other databases) to ensure that duplicate events do not create multiple rows. Use a staging table to deduplicate before merging into the target.

3. Handle Late Data Reprocessing

Identify affected partitions based on event_ts and reprocess them. Use a deduplicated source (e.g., a materialized view or a deduped table) to recompute cohorts, ensuring no double-counting.

4. Design Backfill Plan

Backfill by reprocessing historical data in batches, applying the same deduplication and upsert logic. Validate results by comparing counts before and after, and monitor for anomalies.

5. Monitor and Validate

Set up monitoring for duplicate rates, late-arriving data volumes, and cohort consistency. Use data quality checks to ensure deduplication and backfill are effective.

Key Points to Mention

  • Composite key (user_id, event_ts, event_type) for deduplication
  • Idempotent upsert using MERGE or INSERT ON CONFLICT
  • Partitioning by event_ts to efficiently reprocess late data
  • Using a deduplicated source of truth for cohort analysis
  • Backfill in batches with validation and monitoring
  • Trade-offs between storage cost and query performance for deduplication

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Define the grain for a derived metrics table covering weekly retention by signup cohort and ARPU by cohort. Show the SQL pattern you'd use, explain how incremental materialization works, and describe data quality checks you'd put in place.

Product Analytics & MetricsData ModelingSystem Design
Author's notes

SQL window functions I can do in my sleep, so PARTITION BY signup_week ORDER BY week_index for retention felt fine.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the business definitions of retention and ARPU, then define the grain as one row per signup cohort per week (or per cohort per period). Walk through the SQL pattern using window functions and aggregations, explain how incremental materialization updates only new cohorts/weeks, and finish with concrete data quality checks.

Pro tip: Emphasize that the grain must support both metrics without double-counting: retention is cohort-week level, while ARPU is cohort-level, so you may need two tables or a carefully designed grain. Mention that at Snowflake, you'd leverage streams and tasks for incremental processing.

1. Clarify definitions and grain

Define retention (e.g., active in week N after signup) and ARPU (revenue per user in cohort). Specify grain as one row per signup cohort per week for retention, and one row per signup cohort for ARPU, or a combined grain if needed.

2. Show SQL pattern

Write a query that joins signups with activity and revenue, groups by cohort and week, and computes retention and ARPU using conditional aggregation and window functions.

3. Explain incremental materialization

Describe how to use Snowflake streams and tasks to capture new signups and activity, and merge only new or updated cohorts/weeks into the target table, avoiding full refreshes.

4. Outline data quality checks

List checks such as uniqueness of cohort-week, completeness of cohorts, validity of retention rates (0-100%), and reconciliation of ARPU with source revenue.

Key Points to Mention

  • Grain definition: one row per signup cohort per week for retention, and per cohort for ARPU; avoid mixing grains in one table unless carefully designed.
  • SQL pattern: use CTEs to calculate cohort sizes, weekly active users, and revenue, then join and aggregate.
  • Incremental materialization: use Snowflake streams to capture changes and tasks to merge new data, with a merge statement that updates only new cohorts/weeks.
  • Data quality checks: uniqueness, completeness, range checks, and reconciliation with source systems.
  • Handling late-arriving data: use a lookback window or reprocess affected cohorts.
  • Performance considerations: partition by cohort date and cluster by week for efficient queries.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

Estimate table sizes for this 50M events/day system, justify your clustering key choices for typical queries like top-N countries over the last 8 weeks and rolling DAU/WAU/MAU, and walk through cost controls including partition pruning, approximate distinct counts, and result caching.

System DesignTechnical Trade-offsProduct Analytics & Metrics
Author's notes

Rough math: 50M events at maybe 500 bytes each uncompressed, compressed down to maybe 100 bytes, so around 5GB per day, 40GB for an 8-week window.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by estimating raw data volume and compressed storage for 50M daily events, then map typical query patterns to clustering keys that minimize scanned data. Walk through cost controls like partition pruning, approximate distinct counts, and result caching, quantifying savings where possible.

Pro tip: Always tie clustering choices to specific query patterns and quantify the impact on scan size and cost—this shows you understand Snowflake's architecture and cost model, not just generic data modeling.

1. Estimate table sizes

Calculate raw event size (e.g., 1KB/event) and apply Snowflake's typical 3-5x compression to get storage per day, then extrapolate for retention periods (e.g., 8 weeks, 1 year).

2. Analyze query patterns

Identify frequent queries: top-N countries over last 8 weeks (filter on date and country) and rolling DAU/WAU/MAU (filter on date, aggregate distinct users).

3. Choose clustering keys

For top-N countries, cluster by (event_date, country) to prune on date and co-locate country data; for DAU/WAU/MAU, cluster by (event_date) or (event_date, user_id) to optimize date-range scans and distinct counts.

4. Implement cost controls

Use partition pruning via clustering, approximate distinct counts (HLL) for DAU/WAU/MAU, and result caching for repeated queries; also consider materialized views for pre-aggregated metrics.

5. Validate and iterate

Monitor query profiles and clustering depth, adjust keys as query patterns evolve, and measure cost savings from pruning, approximations, and caching.

Key Points to Mention

  • Snowflake's micro-partitioning and automatic clustering: clustering keys improve pruning by co-locating related data.
  • Compression ratios: Snowflake typically achieves 3-5x compression on event data, reducing storage costs.
  • Approximate distinct counts: Use HyperLogLog (HLL) or Snowflake's APPROX_COUNT_DISTINCT for DAU/WAU/MAU to reduce compute.
  • Result caching: Snowflake's 24-hour result cache can serve repeated queries without compute cost.
  • Partition pruning: Clustering on event_date ensures date-range filters scan only relevant micro-partitions.
  • Trade-offs: Clustering has maintenance costs; choose keys that benefit the most frequent and expensive queries.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.