Backup vs replica — which one actually saves your database

You have a replica. Data copies over instantly, everything's green.
You run a DELETE without a WHERE — and a fraction of a second later the replica is empty too.
That's the thing to understand about this pair: a replica is not a spare copy for when you make a mistake. It faithfully repeats everything you did, stupidity included. Let's sort out what saves you from what.
A replica is for "the server died"
A replica (also called a standby, or a read replica) is a second server that continuously receives the stream of changes from the primary and applies them locally.
The PostgreSQL docs put the purpose plainly: servers work together "to allow a second server to take over quickly if the primary server fails", or to let several machines serve the same data.
What it saves you from:
- dead hardware, dead disk, dead data centre
- surviving an upgrade without downtime
- heavy reports choking the main database — you move them to the replica
What it doesn't save you from: a command. A replica can't tell a correct DELETE from an "oops". In asynchronous mode the lag is a fraction of a second; that's exactly how long you have to change your mind.
A backup is for "I deleted the wrong thing"
A backup is a snapshot of a moment in time that lives separately and does not follow the database around.
It gets interesting when you add a change log to that snapshot (in PostgreSQL, the WAL). Then you get PITR — point-in-time recovery. The docs describe it literally: you don't have to replay the log to the end, you can "stop the replay at any point and have a consistent snapshot of the database as it was at that time".
The key word is stop. That's the whole difference: a replica already applied your mistake and lives with it, while PITR can be wound forward to 14:32:59 and not to 14:33:00, when you pressed Enter.
Compared on what actually hurts
What it protects against. Replica — hardware and site failure. Backup — humans, a bad migration, a bug in the code, ransomware.
How fast you're back up. Replica — seconds or minutes: switch traffic and carry on. Backup — tens of minutes to hours: you have to restore a copy and replay the log.
How much data you lose. Replica — almost none, lag is sub-second. Backup without a log — everything since the last snapshot, usually up to a day. Backup with PITR — seconds.
What it costs. A replica is a second running server, so roughly the price of the database again. A backup is storage space, usually pennies.
How much fiddling. A replica needs failover setup and an answer for split brain, when both servers decide they're primary. A backup needs one thing: regularly checking that it actually restores.
Who should pick what
Straight answer, no "it depends".
- Side project, first product, up to a few thousand users: backup. You don't need a replica. Half an hour of downtime once a year is survivable; lost data isn't.
- Paying users or money inside: backup with PITR plus a replica. In that order.
- A replica with no backup: don't. That's protection against the rarest failure (the server died) with zero protection against the most common one (a human erred).
If the budget allows only one, take the backup. With it you lose time; without it you lose data.
The compromise few people know about
There's a third option — a delayed replica. In PostgreSQL it's a single parameter: recovery_min_apply_delay.
It defaults to zero, so the replica applies changes immediately. Set it to 5min and it will replay each transaction only once five minutes have passed since that transaction committed on the primary.
What that buys you: a five-minute head start. Spot the DELETE without a WHERE in three minutes and the data is still sitting on the delayed replica, which becomes your recovery source without unpacking yesterday's archive. The docs describe the parameter's purpose the same way: a chance to correct data-loss errors using a time-delayed copy.
The honest caveat: this doesn't replace a backup. In six minutes, it catches up too.
Is a disk snapshot a backup?
Half of one. A cloud provider's disk snapshot restores fast, but it's taken on a live disk, so the restored database may come up as if the power had been cut. Usually it survives that — but test it in advance, not on the day of the incident.
My managed database has backups switched on — can I relax?
Check two things. First, retention: free tiers often keep 7 days, and a mistake in a rarely used table gets noticed a month later. Second, what happens when the project is deleted or the invoice goes unpaid: with many providers, backups live inside that same project and leave with it. One dump exported to separate storage closes both risks.
How do I know the backup works?
Only one way: restore it into a separate database and run a couple of queries. A backup you've never restored isn't a backup, it's a hope. Make it a scheduled job once a month — you can restore it right next to your regular test database.
The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.





