An engineer ran `DELETE FROM orders;` on the production Postgres (forgot the `WHERE`) at 14:32.
BeginnerTroubleshootingData loss and corruption
Answer
Likely causes → A manual write against production with no guardrails: direct psql access, autocommit on, no peer review.
Diagnose → Pin the exact time of the statement from the DB logs (log_statement = 'mod') or CloudTrail/pgaudit, and work out which tables were touched and what writes happened after it.
Fix → Don't restore over the live database. Restore a copy to just before the mistake and copy the missing rows back:
flowchart LR
A["Find exact time of DELETE"] --> B["PITR restore to new instance at 14:31:59"]
B --> C["Export deleted rows"]
C --> D["Insert into prod, skip conflicts"]
D --> E["Reconcile counts and totals"]
aws rds restore-db-instance-to-point-in-time --source-db-instance-identifier prod \
--target-db-instance-identifier prod-pitr-1431 --restore-time 2026-11-09T14:31:59Z
pg_dump -h prod-pitr-1431... -t orders --data-only -Fc -f orders.dump
Prevent → No routine human write access to production. Use reviewed migration or runbook scripts, BEGIN; before any manual change, and test PITR restores regularly.
More on Data loss and corruption
A cleanup script deleted every object under `s3://acme-invoices/2025/`. Versioning is enabled.BeginnerYou need to restore last night's MySQL backup and discover the dump files for the past three months are 20 KB each.IntermediateUsers update their profile, the page reloads, and they see the old values; a minute later the new values show up.IntermediateA network partition between data centres lasted 4 minutes; afterwards you find both sites accepted writes as primary, and the same order IDs exist with different contents.AdvancedA deploy ran a migration that dropped the `phone` column; old pods still running during the rolling update threw 500s, and a background job wrote nulls into a new table.IntermediateSomeone ran `helm uninstall` on the production Postgres release; the PVC was deleted and the StorageClass has `reclaimPolicy: Delete`.Beginner