Question 41
MediumA sharded user table uses the first letter of the name as the shard key. What problem is likely?
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
DBMS
A sharded user table uses the first letter of the name as the shard key. What problem is likely?
Joins become faster
Uneven shards, since some letters are much more common
All data goes to one replica
No problem
Sign up free to see the answer and a step-by-step explanation.
Why is consistent hashing used to place keys on nodes?
It encrypts keys
Adding or removing a node moves only a small part of the keys
It sorts the keys
It makes all keys equal
Sign up free to see the answer and a step-by-step explanation.
In MongoDB, a blog post and its comments are almost always read together, and there are only a few comments per post. What design suits this?
Store each comment in a separate database
Embed the comments inside the post document
Create a join table
Store comments in a key-value cache only
Sign up free to see the answer and a step-by-step explanation.
In MongoDB, a product is referenced by millions of orders. Why should orders reference the product rather than embed it?
References are always faster
Embedding would copy the product into every order and make updates to it very costly
MongoDB forbids embedding
Products are too small
Sign up free to see the answer and a step-by-step explanation.
Which property does a 'read-your-writes' consistency guarantee give?
Reads are always from the leader
Everyone sees all writes immediately
After you write, your own later reads see that write
Writes never fail
Sign up free to see the answer and a step-by-step explanation.
In leader–follower replication, what is replication lag?
The delay before a follower applies writes made on the leader
The disk latency of the leader
The time to elect a leader
The time to back up the leader
Sign up free to see the answer and a step-by-step explanation.
What happens in a leader–follower system when the leader fails?
All data is lost
Writes go to every follower at once
A follower is promoted to become the new leader (failover)
The system becomes read-only forever
Sign up free to see the answer and a step-by-step explanation.
What is a document's _id field in MongoDB?
A pointer to another collection
Its primary key, unique within the collection
A timestamp only
The document's size
Sign up free to see the answer and a step-by-step explanation.
Which query pattern is hard for a key-value store?
Find all users who live in Pune and are over 30
Get the value for key user:42
Update key cart:7
Delete key session:9
Sign up free to see the answer and a step-by-step explanation.
In Cassandra, why must the table be designed around the queries that will be run?
Cassandra supports unlimited joins
Tables are automatically normalised
Data is partitioned by key, and efficient queries must hit a known partition
Cassandra has no keys
Sign up free to see the answer and a step-by-step explanation.