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. It helps split the data into chunks for efficient storage and retrieval.
Click to reveal answer
beginner
Why is choosing the right shard key important?
Choosing the right shard key is important because it affects how evenly data and workload are distributed across shards. A good shard key improves performance and scalability, while a bad one can cause bottlenecks and uneven load.
Click to reveal answer
intermediate
What happens if the shard key causes data to be unevenly distributed?
If the shard key causes uneven data distribution, some shards get overloaded while others stay underused. This leads to slower queries and can reduce the cluster's overall efficiency.
Click to reveal answer
intermediate
How does a shard key affect query performance?
A shard key that matches query patterns allows MongoDB to target specific shards, making queries faster. If the shard key is not used in queries, MongoDB must search all shards, slowing down performance.
Click to reveal answer
advanced
Can the shard key be changed after sharding a collection?
No, MongoDB does not allow changing the shard key after sharding a collection. To change it, you must create a new sharded collection with the desired shard key and migrate data.
Click to reveal answer
What is the main role of a shard key in MongoDB?
✗ Incorrect
The shard key determines how data is divided across shards to balance storage and workload.
What is a consequence of choosing a poor shard key?
✗ Incorrect
A poor shard key can cause uneven data distribution, overloading some shards.
Which query pattern benefits most from a good shard key?
✗ Incorrect
Queries using the shard key can target specific shards, improving speed.
Can you change the shard key of a collection after sharding it?
✗ Incorrect
MongoDB does not allow changing the shard key; you must create a new sharded collection.
Which of these is a good characteristic of a shard key?
✗ Incorrect
A shard key with many unique values helps distribute data evenly.
Explain why selecting the right shard key is crucial for MongoDB performance and scalability.
Think about how data and queries spread across servers.
You got /4 concepts.
Describe what happens if a shard key causes uneven data distribution and how it affects the cluster.
Imagine some servers working too hard while others are idle.
You got /4 concepts.