Question 51
MediumWhat does a time-to-live (TTL) on a Redis key do?
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
DBMS
What does a time-to-live (TTL) on a Redis key do?
Locks the key
Deletes the key automatically after the given time
Encrypts the key
Copies the key to disk
Sign up free to see the answer and a step-by-step explanation.
A graph database query finds 'people within three hops of Asha'. Why is this faster than in SQL?
Relationships are stored as direct links, so traversal doesn't need repeated joins
SQL cannot count
Graph databases have no data
Graph databases store everything in one row
Sign up free to see the answer and a step-by-step explanation.
What is a 'polyglot persistence' architecture?
Writing data in many languages
Translating SQL into other languages
Using different databases for different needs in one system, such as SQL for orders and Redis for caching
Using one database for everything
Sign up free to see the answer and a step-by-step explanation.
What does 'schema-on-read' mean in document databases?
The structure is interpreted when the data is read, not enforced when it is written
Data is read only once
A schema must be created first
Schemas are stored in a file
Sign up free to see the answer and a step-by-step explanation.
A system stays available during a network partition but may return stale data. In CAP terms, what is it?
None of these
AP (available and partition-tolerant)
CP (consistent and partition-tolerant)
CA (consistent and available)
Sign up free to see the answer and a step-by-step explanation.
With N replicas, writes acknowledged by W replicas and reads querying R replicas, which condition ensures a read sees the latest write?
R + W < N
R = W
R + W > N
W = 1
Sign up free to see the answer and a step-by-step explanation.
In MongoDB, why might you embed related data in a document rather than reference it in another collection?
Embedding always reduces storage
Embedding is required for indexing
Data that is read together can then be fetched in one read without a join
References are not allowed in MongoDB
Sign up free to see the answer and a step-by-step explanation.
What is a hot spot (hot partition) in a sharded database?
A shard with no data
A shard receiving far more traffic than others because of a poor shard key
A server that is overheating
A replica that is out of date
Sign up free to see the answer and a step-by-step explanation.
Which use case suits a key-value store like Redis best?
Storing a social graph with deep traversals
Caching user sessions with fast lookups by session ID
Running complex reports with many joins
Enforcing foreign-key constraints
Sign up free to see the answer and a step-by-step explanation.
Why do many NoSQL databases avoid joins across the whole data set?
Joins are mathematically impossible
Joins need SQL syntax only
Joins across shards on different servers are slow, so data is denormalised for the queries it serves
NoSQL data has no keys
Sign up free to see the answer and a step-by-step explanation.