0
0
MongoDBquery~5 mins

Hash-based sharding in MongoDB - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is hash-based sharding in MongoDB?
Hash-based sharding is a method where MongoDB uses a hash of the shard key's value to distribute data evenly across shards. This helps balance the load by spreading documents uniformly.
Click to reveal answer
beginner
Why does MongoDB use a hash of the shard key for sharding?
Using a hash of the shard key ensures data is spread evenly across shards, preventing hotspots where one shard gets too much data or traffic.
Click to reveal answer
intermediate
How does hash-based sharding differ from range-based sharding?
Hash-based sharding distributes data by hashing the shard key, creating a uniform spread. Range-based sharding divides data into ranges of shard key values, which can lead to uneven distribution if data is skewed.
Click to reveal answer
beginner
What is a shard key in MongoDB's hash-based sharding?
A shard key is a field or set of fields in a document that MongoDB uses to determine how to distribute data across shards. In hash-based sharding, the hash of this key decides the shard placement.
Click to reveal answer
intermediate
What is a potential downside of hash-based sharding?
Hash-based sharding can make range queries less efficient because data is spread randomly, so related data might be on different shards.
Click to reveal answer
What does MongoDB use to decide where to place data in hash-based sharding?
AThe range of shard key values
BThe document's creation date
CThe size of the document
DA hash of the shard key value
Which is a benefit of hash-based sharding?
AData always stored on a single shard
BFaster range queries
CEven data distribution across shards
DData stored in sorted order
What is a shard key in MongoDB?
AA password for database access
BA field used to split data across shards
CThe name of the database
DThe size limit of a shard
What is a downside of hash-based sharding?
ARange queries can be slower
BData is not evenly distributed
CIt only works with numeric keys
DIt requires manual data balancing
How does hash-based sharding compare to range-based sharding?
AHash-based spreads data evenly; range-based can cause uneven distribution
BRange-based always spreads data evenly; hash-based does not
CBoth methods store data in sorted order
DHash-based sharding is slower in all cases
Explain how hash-based sharding works in MongoDB and why it is used.
Think about how hashing helps spread data evenly.
You got /4 concepts.
    Describe one advantage and one disadvantage of using hash-based sharding.
    Consider how data is spread and how queries might be affected.
    You got /2 concepts.