Recall & Review
beginner
What is a shard key in MongoDB?
A shard key is a field or set of fields that determines how data is distributed across different shards in a MongoDB cluster.
Click to reveal answer
beginner
Why should a shard key have high cardinality?
High cardinality means many unique values, which helps distribute data evenly across shards and avoids hotspots.
Click to reveal answer
beginner
What happens if a shard key has low cardinality?
Data may cluster on a few shards causing uneven load and poor performance.
Click to reveal answer
intermediate
How does a shard key affect query performance?
A good shard key allows queries to target specific shards, reducing the amount of data scanned and improving speed.
Click to reveal answer
intermediate
What is a common mistake when choosing a shard key?
Choosing a shard key that is monotonically increasing, like a timestamp or ObjectId, can cause all writes to go to one shard, creating a bottleneck.
Click to reveal answer
Which property is important for a good shard key?
✗ Incorrect
A good shard key should have high cardinality to distribute data evenly.
What is a risk of using a monotonically increasing shard key?
✗ Incorrect
Monotonically increasing keys cause writes to target one shard, creating a bottleneck.
How does a good shard key improve query performance?
✗ Incorrect
A good shard key lets queries target only relevant shards, speeding up queries.
Which shard key choice can cause uneven data distribution?
✗ Incorrect
Few unique values cause data to cluster on few shards, leading to imbalance.
What is a compound shard key?
✗ Incorrect
A compound shard key uses multiple fields to improve data distribution.
Explain what makes a shard key good for MongoDB sharding.
Think about how data spreads and how queries use the shard key.
You got /4 concepts.
Describe the problems caused by choosing a monotonically increasing shard key.
Consider how data is inserted over time.
You got /4 concepts.