0
0
HLDsystem_design~5 mins

Shard key selection in HLD - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a shard key in distributed databases?
A shard key is a specific field or set of fields used to divide data into smaller parts called shards. It helps distribute data across multiple servers to improve performance and scalability.
Click to reveal answer
beginner
Why is choosing the right shard key important?
The right shard key ensures even data distribution, reduces hotspots, and improves query performance. A poor choice can cause uneven load and slow down the system.
Click to reveal answer
intermediate
What are common criteria for selecting a shard key?
Common criteria include high cardinality (many unique values), frequent use in queries, even data distribution, and low update frequency to avoid moving data between shards.
Click to reveal answer
intermediate
Explain the impact of a low-cardinality shard key.
A low-cardinality shard key has few unique values, causing data to cluster in few shards. This leads to uneven load, hotspots, and poor scalability.
Click to reveal answer
intermediate
What is a hotspot in sharding, and how does shard key selection affect it?
A hotspot is a shard that receives a disproportionate amount of traffic or data. Choosing a shard key that evenly distributes data and queries helps prevent hotspots.
Click to reveal answer
Which property is most important for a shard key to ensure even data distribution?
AHigh cardinality
BLow update frequency
CUsed in rare queries
DSmall data size
What happens if a shard key causes data to cluster on a few shards?
AImproved query speed
BHotspots and uneven load
CAutomatic data balancing
DReduced storage needs
Which shard key characteristic helps reduce data movement between shards?
AUsed only in writes
BHigh update frequency
CLow update frequency
DRandom values
Why should a shard key be frequently used in queries?
ATo avoid data partitioning
BTo increase data duplication
CTo reduce shard count
DTo improve query routing and performance
Which of these is NOT a good shard key choice?
ACountry code with 3-4 unique values
BUser ID with millions of unique users
COrder ID with unique values
DSession token with high uniqueness
Explain how to select a shard key for a large user database.
Think about what uniquely identifies users and how queries are made.
You got /4 concepts.
    Describe the consequences of a poor shard key choice in a distributed system.
    Consider what happens when data is not balanced across servers.
    You got /4 concepts.