Stop 13 · Views, Procedures & SecurityTopics · 9/9

Backups and Restores

Part of the SQL Roadmap

In short

Someone runs DELETE without a WHERE clause. It happens to good engineers. Whether that's a five-minute fix or a career-defining disaster depends entirely on your backups and how well you know them.

A backup is only useful if you can restore it. Logical backups (mysqldump, pg_dump) save SQL or data you can reload, while physical backups and point-in-time recovery restore the whole server to a moment in time.

The blob character photographs a whiteboard full of diagrams with a phone.

Think of it like this

Photo of the whiteboard

Before the teacher wipes the board, you snap a photo. If you lose your notes, the photo brings back exactly what was there at that moment. Snapshots are photos of your database, and point-in-time restore is a video you can pause anywhere.

Watch it happen

Restoring to just before the mistake

Mon 02:00
0
Tue 02:00
1
Wed 02:00
2
Thu 02:00
3
Thu 10:41
4
Thu 10:42
5

1/5RDS takes a daily automated snapshot and also saves transaction logs every few minutes.

The big ideas

What you need to know

Automated backups

Daily snapshots plus logs, kept for a retention period you set (up to 35 days on RDS). Enables point-in-time restore.

Manual snapshots

Taken on demand, before risky changes. Kept until you delete them, even if the database is deleted.

Restore makes a new DB

Restores never overwrite the original. You get a fresh instance and then decide how to use it.

Copy elsewhere

Copy snapshots to another region or account so a regional issue or a compromised account can't destroy them.

See it in code

Walk through the code

bash
1# Before a risky migration, take a manual snapshot2aws rds create-db-snapshot \3  --db-instance-identifier notes-db \4  --db-snapshot-identifier notes-db-before-v25 6# Oops. Restore to one minute before the mistake (UTC)7aws rds restore-db-instance-to-point-in-time \8  --source-db-instance-identifier notes-db \9  --target-db-instance-identifier notes-db-restored \10  --restore-time 2026-10-29T05:11:00Z

1/2A named manual snapshot you can return to after a migration.

Times are in UTC. 10:41 in India (IST) is 05:11 UTC. Getting the time zone wrong restores the wrong moment.

Save yourself the pain

Common mistakes

Oops

Assuming backups work because the setting is on.

Do this instead

Restore a backup to a test instance every month and check the data. That's the only real proof.

Oops

Deleting a database and its automated backups together without a final snapshot.

Do this instead

Take a final snapshot when deleting. Automated backups are usually removed with the instance.

Your mission

Undo a disaster

~40 min

Quick check

A table was wiped at 15:30. The last snapshot was at 02:00. How do you lose the least data?

Go deeper

  1. 1Back up your practice database with mysqldump or pg_dump.
  2. 2Restore it into a new, empty database and check the row counts match.
  3. 3Write down how long the restore took and how much data you could lose between backups.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge