Skip to content
RED SAGSkills
hardData Engineer interview question

How do you choose partitioning and clustering for a very large table? What can go wrong?

What the interviewer wants to hear

  • Base it on the most common query filters
  • Choose low-to-medium cardinality partition keys like date
  • Avoid too many small partitions
  • Use clustering or sort keys for high-cardinality filters
  • Watch for skewed partitions and functions that block pruning
  • Re-evaluate as query patterns change

Model answer

I start from how the table is queried: the filters and joins that appear in most queries and in the most expensive ones. Usually that is a date, so I partition by day or month. The partition key should have a moderate number of values; partitioning by user_id or by hour over many years creates millions of tiny partitions, which slows planning and creates small files. For high-cardinality filters like customer_id, I use clustering in BigQuery or Snowflake, Z-ordering or liquid clustering in Delta, or sort keys in Redshift, so the engine can skip data blocks within partitions. Things that go wrong: skewed partitions where one day is huge, queries that wrap the partition column in a function and lose pruning, and choosing a key nobody filters on. I check pruning in query profiles and revisit the design as query patterns change.

Can you answer it under time pressure?

Take a timed hard round and get scored on every answer.

Start mock interview

More hard Data Engineer questions