Are distribution keys short or long in Redshift?
1Times asked
Jul 2026Last seen
Jul 2026First seen
💡 Model Answer
In Redshift, a distribution key (DISTKEY) determines how rows are distributed across the cluster’s slices. The key can be a single column (short key) or a composite of multiple columns (long key). Choosing the right key is critical for performance:
- Short key (single column) – Simpler to manage and often used when the column has high cardinality and is frequently used in joins. It reduces the chance of data skew.
- Long key (composite) – Useful when a single column does not provide enough uniqueness. A composite key can balance data more evenly but may increase the size of the key and the cost of hashing.
Guidelines:
- High cardinality – Prefer keys with many distinct values to avoid skew.
- Join column – Pick a column that appears in join predicates; this keeps related rows on the same slice.
- Avoid low‑cardinality columns – Columns like gender or status can cause skew.
- Consider query patterns – If you often filter by a combination of columns, a composite key may be beneficial.
- Test with sample data – Use the
ANALYZEcommand to see distribution statistics.
In practice, many teams start with a short key on a high‑cardinality column and only move to a long key if skew or performance issues arise.
This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.
🎤 Get questions like this answered in real-time
Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.
Get Assisting AI — Starts at ₹500