Recovery
- SQL course
- Expert
- Lesson 40/45
- 5 min
Learn point-in-time recovery.
Recovery
Recovery restores damaged or deleted data from a backup. Point-in-time recovery (PITR) rolls data back to a specific moment; WAL logs make it possible.
COPY orders FROM '/tmp/orders.csv';
-- PITR: WAL logları belirli ana kadar yürütülürPITR restores to a specific moment.
Recovery — details
During restore the database is unavailable. In PITR a full backup is loaded first, then WAL records are replayed in order. The target time stops the WAL replay.
Practice Recovery
Restore the orders table from /tmp/orders.csv: COPY orders FROM '/tmp/orders.csv'.
Starter code
-- recovery
COPY ordersSample solution
COPY orders FROM '/tmp/orders.csv';Expected output
COPY 5
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Import
COPY orders FROM '____';
COPY orders FROM '/tmp/orders.csv';
Explanation: /tmp/orders.csv is the right answer.
2 Recovery: match the terms
| Term | Meaning |
|---|---|
recovery |
recovery |
PITR |
point-in-time |
WAL |
log |
restore |
restore |
3 What does PITR provide?
- Less disk space
- Restoring to a specific point in time Correct answer
- Faster writes
- Column compression
Explanation: PITR provides restore to a specific moment.