What is point-in-time recovery in database management?
Short answer: Point-in-time recovery (PITR) allows you to restore a database to a specific moment in time, which can be crucial in scenarios where: Data corruption or accidental deletion occurs.
Explain a bit more
You want to rollback to a specific moment before a harmful event. How it works: First, a full backup is restored. Then, transaction log backups are applied, allowing you to replay changes made after the full backup until the specified point in time. SQL Server
Example code
RESTORE DATABASE MyDatabase FROM DISK = 'C:\Backups\MyDatabase.bak'; RESTORE LOG MyDatabase FROM DISK = 'C:\Backups\MyDatabase_log.trn' WITH STOPAT = '2023-09-14T15:30:00'; -- Restore up to a specific time PostgreSQL Example: To enable point-in-time recovery, you need to restore a base backup, then use WAL (Write-Ahead Logging) archives to apply changes until the desired point. You would also set the restore_command in recovery.conf and specify the recovery_target_time.
Say this in the interview
- Define — one clear sentence (the short answer above).
- Example — relate it to a project like ShopNest or your real work.
- Trade-off — when you would not use it.
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png