0
0
DynamoDBquery~5 mins

On-demand backups in DynamoDB - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: On-demand backups
O(n)
Understanding Time Complexity

When we create on-demand backups in DynamoDB, we want to know how the time it takes changes as the size of the data grows.

We ask: How does the backup process time grow when the table has more data?

Scenario Under Consideration

Analyze the time complexity of the following DynamoDB on-demand backup command.


aws dynamodb create-backup \
  --table-name MusicCollection \
  --backup-name MusicBackup2024
    

This command creates a full backup of the entire MusicCollection table at the moment it runs.

Identify Repeating Operations

Look for repeated work inside the backup process.

  • Primary operation: Reading all items from the table to copy them.
  • How many times: Once for each item in the table.
How Execution Grows With Input

As the number of items in the table grows, the backup time grows too.

Input Size (n)Approx. Operations
10About 10 item reads and copies
100About 100 item reads and copies
1000About 1000 item reads and copies

Pattern observation: The time grows roughly in direct proportion to the number of items.

Final Time Complexity

Time Complexity: O(n)

This means the backup time increases linearly as the table size grows.

Common Mistake

[X] Wrong: "Creating an on-demand backup takes the same time no matter how big the table is."

[OK] Correct: The backup copies every item, so more items mean more work and more time.

Interview Connect

Understanding how backup time grows helps you explain system behavior clearly and shows you can think about real-world data sizes.

Self-Check

"What if the table had indexes? How would backing up those indexes affect the time complexity?"