Recovery objectives: RPO and RTO
Overview
Recovery point objective (RPO) is the acceptable data-loss window expressed in time; recovery time objective (RTO) is the target time to restore the required service after disruption. They are objectives, not measured results or guarantees. A recovery point is the latest consistent recoverable state, not necessarily the time of the last backup file. RTO includes detection, decision, recovery, routing and validation under the chosen service definition.
First example
SELECT id,failure_s-recovered_point_s,available_s-failure_s FROM ra_incident ORDER BY id;Observed SQLite result (rows in JSON):
[ [ 1, 20, 30 ], [ 2, 30, 60 ]]How it works
The incident table is synthetic: failure at second 60, recoverable state at 40 or 30, service restored at 90 or 120. Subtract timestamps to obtain observed-in-model loss windows and outage durations; compare with targets 25 and 40 seconds. The first meets both, the second misses both. Real evaluation needs restore drills, business acceptance criteria, independent backups and monitoring. A zero time gap is not proof of no lost transactions unless the recovery point is verified.
Practical example
SELECT id,failure_s-recovered_point_s<=rpo_target_s,available_s-failure_s<=rto_target_s FROM ra_incident ORDER BY id;Observed SQLite result (rows in JSON):
[ [ 1, 1, 1 ], [ 2, 0, 0 ]]Practice and mistakes
Practice: for incident 2, identify both violations. Hint 1: failure minus recovered point. Hint 2: availability minus failure. Plan a restore drill with an isolated target and a verified transaction ledger; do not confuse availability with disaster recovery.
PostgreSQL 17 example — NOT RUN
WITH incident(failure_s,recovered_s,available_s) AS (VALUES (60,40,90))SELECT failure_s-recovered_s AS loss_window_s,available_s-failure_s AS outage_s FROM incident;Expected result, not executed: "Synthetic result: 20,30 seconds; no actual recovery timing."