CodeBlanks Logo Icon CodeBlanks

Recovery

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ür

PITR 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

query.sql
-- recovery
COPY orders

Sample solution

query.sql
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

Question
COPY orders FROM '____';
Answer
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.

All lessons in Expert