InterviewStack.io LogoInterviewStack.io

Data Partitioning and Sharding Questions

Techniques and operational practices for horizontally partitioning data across multiple database instances or storage nodes to achieve scale, improve performance, and manage growth. Includes selection and design of partition and shard keys to evenly distribute load and avoid hotspots, with range based, hash based, and directory based approaches and consistent hashing mechanisms. Covers handling uneven distribution and data skew, hotspot detection and mitigation, and the impact of partitioning on query patterns such as joins and cross shard queries. Explains implications for transactions and consistency, including transactional boundaries that span partitions and approaches to distributed transactions and compensation. Describes resharding and online data migration strategies, rolling rebalances, and methods to minimize downtime and data movement. Emphasizes operational concerns including shard management, automation, monitoring and alerting, failure recovery, and performance tuning. Discusses trade offs between simplicity, latency, throughput, and operational complexity and highlights considerations for both transactional and analytical workloads, including routing, caching, and coordination patterns.

MediumTechnical
75 practiced
Given expected growth to 100M users and average user data size of 5MB, design a capacity plan that estimates number of shards, storage needs, and per-shard throughput if each user generates 1 write per day and reads average 50 requests/day. Show calculations and assumptions clearly.
HardTechnical
135 practiced
Implement (pseudocode allowed) an algorithm that assigns virtual nodes to physical shards to balance expected load when physical shards have different capacities (heterogeneous hardware). Explain how you compute the number of vnodes per shard and how you verify balanced distribution.
MediumTechnical
87 practiced
Describe a programmatic approach to detect data skew across shards using production telemetry. Explain what signals you'd compute, how you'd normalize for traffic patterns, and one automated mitigation you could apply when a shard is overloaded.
HardSystem Design
85 practiced
Describe online and offline strategies to change the shard key for an existing table containing hundreds of millions of rows. Provide a high-level migration plan that minimizes downtime and preserves data correctness, and explain how you would test and roll back the change.
MediumBehavioral
121 practiced
Tell me about a time when you identified and resolved a production hotspot or data skew issue. Describe the context, your analysis, the actions you took (technical and operational), and the outcome. Use the STAR method (Situation, Task, Action, Result).

Unlock Full Question Bank

Get access to hundreds of Data Partitioning and Sharding interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.