Bird
Raised Fist0
Redisquery~20 mins

RDB snapshots (point-in-time) in Redis - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
RDB Snapshot Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate
1:30remaining
Understanding RDB Snapshot Timing
If a Redis server is configured to save an RDB snapshot every 60 seconds, what will be the state of the data in the snapshot file if the server crashes after 45 seconds of the last snapshot?
AThe snapshot contains all data up to the last 60-second save point, missing changes made in the last 45 seconds.
BThe snapshot contains all data including the last 45 seconds before the crash.
CThe snapshot file will be empty because the server crashed before the next save.
DThe snapshot contains only the data from the last 10 seconds before the crash.
Attempts:
2 left
💡 Hint
Think about when Redis saves snapshots and what happens if it crashes before the next save.
🧠 Conceptual
intermediate
1:00remaining
RDB Snapshot Configuration Impact
Which Redis configuration setting controls how often RDB snapshots are saved to disk?
Atimeout
Bappendonly
Cmaxmemory-policy
Dsave
Attempts:
2 left
💡 Hint
Look for the setting related to snapshot intervals.
🔧 Debug
advanced
1:30remaining
Diagnosing Missing Data After Crash
A Redis server is configured to save snapshots every 30 seconds. After a crash, the RDB file is loaded but recent data is missing. Which of the following is the most likely cause?
AThe append-only file (AOF) was corrupted and Redis ignored it.
BThe server crashed before the next snapshot was saved, so recent changes were lost.
CThe snapshot file was overwritten with an empty file during the crash.
DThe Redis server was configured to never save snapshots.
Attempts:
2 left
💡 Hint
Consider how RDB snapshots work and when data is persisted.
📝 Syntax
advanced
1:00remaining
Correct Redis CLI Command to Trigger Manual RDB Save
Which Redis CLI command triggers an immediate RDB snapshot save to disk?
ASAVEALL
BBGSAVE
CSAVE
DSNAPSHOT
Attempts:
2 left
💡 Hint
One command saves synchronously, the other asynchronously.
❓ optimization
expert
2:00remaining
Optimizing RDB Snapshot Frequency for Data Safety and Performance
You want to configure Redis to balance data safety and server performance by saving RDB snapshots only when at least 100 changes have occurred within 60 seconds. Which 'save' configuration line achieves this?
Asave 60 100
Bsave 100 60
Csave 60 1
Dsave 100 60 1
Attempts:
2 left
💡 Hint
The 'save' directive format is: save

Practice

(1/5)
1. What is the primary purpose of an RDB snapshot in Redis?
easy
A. To increase the speed of Redis commands
B. To save the current state of the database at a specific point in time
C. To permanently delete all data from Redis
D. To replicate data to another Redis instance in real-time

Solution

  1. Step 1: Understand what RDB snapshots do

    RDB snapshots capture the exact data stored in Redis at a certain moment, creating a backup file.
  2. Step 2: Compare options with snapshot purpose

    Only To save the current state of the database at a specific point in time describes saving the database state at a point in time, which matches the snapshot function.
  3. Final Answer:

    To save the current state of the database at a specific point in time -> Option B
  4. Quick Check:

    RDB snapshot = point-in-time save [OK]
Hint: Snapshots save data state at one moment, like a photo [OK]
Common Mistakes:
  • Confusing snapshots with real-time replication
  • Thinking snapshots delete data
  • Assuming snapshots speed up commands
2. Which Redis command creates an RDB snapshot immediately and blocks the server until done?
easy
A. SAVE
B. BGSAVE
C. RESTORE
D. FLUSHDB

Solution

  1. Step 1: Recall Redis commands for snapshots

    SAVE blocks Redis and saves the snapshot immediately; BGSAVE saves in background without blocking.
  2. Step 2: Match command to blocking immediate save

    Only SAVE matches the description of immediate blocking snapshot creation.
  3. Final Answer:

    SAVE -> Option A
  4. Quick Check:

    Immediate blocking snapshot = SAVE [OK]
Hint: SAVE blocks Redis to save snapshot immediately [OK]
Common Mistakes:
  • Choosing BGSAVE which is non-blocking
  • Confusing RESTORE with saving snapshots
  • Thinking FLUSHDB saves data
3. Given the following Redis commands executed in order:
BGSAVE
SET key1 value1
SAVE
SET key2 value2

Which keys will be present in the RDB snapshot created by the SAVE command?
medium
A. Neither key1 nor key2
B. Only key2
C. Only key1
D. Both key1 and key2

Solution

  1. Step 1: Understand timing of BGSAVE and SAVE

    BGSAVE starts background save but does not block; SET key1 happens after BGSAVE starts, so key1 may or may not be in that snapshot.
  2. Step 2: SAVE blocks and saves immediately after SET key1

    SAVE runs after SET key1 but before SET key2, so the snapshot from SAVE includes key1 but not key2.
  3. Final Answer:

    Only key1 -> Option C
  4. Quick Check:

    SAVE snapshot = keys before SAVE command [OK]
Hint: SAVE snapshot includes keys set before it runs [OK]
Common Mistakes:
  • Assuming BGSAVE snapshot includes key1 for sure
  • Thinking SAVE snapshot includes key2 set after it
  • Confusing background and immediate saves
4. You run the command BGSAVE but receive an error: "Background save already in progress". What is the best way to fix this?
medium
A. Run FLUSHALL to clear all data and then run BGSAVE
B. Restart the Redis server to clear the background save
C. Run SAVE instead to block and save immediately
D. Wait for the current background save to finish before running BGSAVE again

Solution

  1. Step 1: Understand the error cause

    The error means a background save is already running; Redis does not allow multiple concurrent BGSAVE commands.
  2. Step 2: Choose the proper fix

    Waiting for the current BGSAVE to finish is the correct approach; running SAVE blocks but is not necessary, restarting or flushing data is extreme and unnecessary.
  3. Final Answer:

    Wait for the current background save to finish before running BGSAVE again -> Option D
  4. Quick Check:

    Only one BGSAVE at a time allowed [OK]
Hint: Only one BGSAVE runs at once; wait before retrying [OK]
Common Mistakes:
  • Restarting server unnecessarily
  • Running SAVE without need
  • Flushing data to fix save error
5. You want to ensure Redis creates an RDB snapshot every 5 minutes only if at least 100 keys changed. Which configuration snippet correctly sets this behavior in redis.conf?
hard
A. save 300 100
B. save 100 300
C. save 5 100
D. save 300 5

Solution

  1. Step 1: Understand Redis save syntax

    The syntax is save <seconds> <changes>, meaning save if at least <changes> keys changed in <seconds> seconds.
  2. Step 2: Match 5 minutes and 100 changes

    5 minutes = 300 seconds, so save 300 100 means save every 300 seconds if 100 keys changed.
  3. Final Answer:

    save 300 100 -> Option A
  4. Quick Check:

    save seconds changes = save 300 100 [OK]
Hint: save syntax: save seconds changes (time then count) [OK]
Common Mistakes:
  • Swapping seconds and changes values
  • Using minutes instead of seconds
  • Misunderstanding save triggers
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard