Challenge - 5 Problems
Redis Deletion Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
Difference in behavior between DEL and UNLINK
Given a Redis key named
mykey with a large value, what is the main difference in the output or effect when running DEL mykey versus UNLINK mykey?Attempts:
2 left
💡 Hint
Think about how Redis handles large keys and server blocking.
✗ Incorrect
DEL deletes the key synchronously, blocking the server until the deletion completes, which can cause latency spikes for large keys. UNLINK, introduced later, schedules the key for asynchronous deletion, allowing the server to continue processing other commands immediately.
❓ query_result
intermediate2:00remaining
Output of DEL and UNLINK commands
Assuming the key
tempkey exists in Redis, what will be the output of the commands DEL tempkey and UNLINK tempkey respectively?Attempts:
2 left
💡 Hint
Check the Redis documentation for return values of DEL and UNLINK.
✗ Incorrect
Both DEL and UNLINK return the number of keys that were removed or scheduled for removal. If the key existed, both return 1.
🧠 Conceptual
advanced2:00remaining
Why use UNLINK over DEL for large keys?
Which of the following best explains why you might prefer to use
UNLINK instead of DEL when deleting large keys in Redis?Attempts:
2 left
💡 Hint
Consider server responsiveness during large key deletions.
✗ Incorrect
UNLINK schedules the key for asynchronous deletion, allowing Redis to remain responsive and avoid latency spikes caused by blocking synchronous deletion.
📝 Syntax
advanced2:00remaining
Identify the invalid Redis command usage
Which of the following Redis commands will cause a syntax error?
Attempts:
2 left
💡 Hint
Check if the command requires at least one key argument.
✗ Incorrect
DEL requires at least one key argument. Using DEL without any key causes a syntax error. UNLINK supports multiple keys, so option B is valid.
❓ optimization
expert3:00remaining
Optimizing deletion of multiple large keys
You need to delete 100 large keys in Redis without blocking the server. Which approach is the best to minimize latency impact?
Attempts:
2 left
💡 Hint
Think about asynchronous deletion and command batching.
✗ Incorrect
UNLINK supports multiple keys and deletes them asynchronously in a single command, minimizing latency and server blocking. Running DEL on many keys blocks the server. Running commands one by one with delays is less efficient.