VIEW THIS AS

Auto mode follows the Route Engine until you choose a viewpoint.

YOU ARE HERE

ROUTE CHECK

CONNECTED TO

WHAT NEXT

Use the canonical route for this room, or HELP if you are unsure.

How Database Crash Recovery Works | WAL Replay, REDO, Checkpoints and Incomplete Transactions

Three secondary students review open books and notes together in a classroom.

Database crash recovery works by rebuilding a consistent storage state from the last trustworthy recovery boundary forward. In a write-ahead-logged system, the server reads checkpoint or control metadata, scans WAL records in order, reapplies changes that were durable in the log but not fully reflected in data files, and restores transaction state according to the database’s own recovery model.

The key challenge is partial persistence. At the moment of failure, some dirty pages may already be on disk, some may still contain old data, some writes may have torn, and some transactions may have generated WAL without ever committing. Recovery must distinguish these cases without assuming that all pages are equally old or that every logged change belongs to a committed visible outcome.

Master guide: How Write-Ahead Logging Works · Pillar: How Database Checkpoints Work · Pillar: How Group Commit Works · How X Works Hub


The Direct Answer: Crash Recovery Reconciles WAL With Data Files

The Log Is the Ordered Durable History

WAL records describe changes that the database promised to preserve according to its durability contract.

The Data Files Can Lag Behind

Because dirty pages are written later, restart must compare the durable log with whatever page state survived the crash and replay the missing effects. The result should be a data-file state consistent with the durable transaction history and the engine’s visibility rules.


Recovery Starts From Trusted Control Metadata

The Server Needs a Starting Point

Scanning WAL from database creation would be wasteful.

Checkpoint Information Provides the Boundary

PostgreSQL’s current WAL internals documentation says startup reads pg_control, then the checkpoint record, then begins REDO from the WAL location identified by that checkpoint. This is one concrete implementation of a general recovery principle: find the latest durable baseline and replay forward.


The Latest Checkpoint Record Is Not Simply the Latest File Timestamp

Recovery Metadata Has Explicit Meaning

The checkpoint identifies a redo location under the database’s protocol.

File Modification Times Are Incidental

Data pages, WAL segment files and control files can be written at different wall-clock moments. Recovery trusts the engine’s recorded positions, not operating-system timestamps.


Why Redo Is Necessary Even After Commit

Commit Can Finish Before Data Pages Are Written

The WAL containing the transaction’s changes can be durable while table and index pages still contain older images.

Redo Materialises the Durable Decision

Crash recovery replays the WAL so committed changes that had not reached data files are reconstructed. This is the performance bargain at the heart of WAL: faster commit now, deterministic replay later if needed.


Recovery Must Also Tolerate Pages That Already Contain the Change

Some Dirty Pages Reach Disk Before the Crash

Background writers operate independently.

Redo Cannot Blindly Apply Everything Twice

Pages or records carry enough state for the engine to determine whether a WAL change is already reflected. Position checks, page LSNs or operation-specific idempotence make replay safe. Exact techniques vary by engine.


The Page LSN Idea

A Page Can Remember the Latest WAL Position Applied to It

When recovery sees a WAL record older than or equal to the page’s durable state, replay can often skip the physical action.

Later Records Still Need Applying

The comparison turns WAL replay into a catch-up process. Recovery advances pages from their surviving position toward the durable WAL frontier instead of reconstructing every page from scratch.


Torn Pages Complicate the Comparison

A Partial Write Can Damage the Page Header and Data Together

The surviving page image may not be self-consistent.

Full-Page Protection Provides a Recovery Base

PostgreSQL’s full_page_writes records a full page image on the first modification after a checkpoint. During REDO, that image can restore the entire page before later records are applied. Other systems can use different torn-write protection mechanisms.


Recovery Is Ordered Because WAL Is Ordered

Later Changes Can Depend on Earlier Ones

A page split, tuple insertion or transaction record assumes prior state.

Replay Follows Log Sequence

The WAL stream provides a deterministic order for reconstructing changes. Parallel recovery optimisations may exist, but they must preserve the dependencies and final semantics encoded by the log.


Committed and Incomplete Transactions Need Different Outcomes

A Transaction Can Generate WAL Before Commit

Its low-level changes may be represented in the log.

The Engine’s Transaction Model Determines Visibility

PostgreSQL can replay physical changes while MVCC and transaction-status information keep incomplete transactions invisible. ARIES-style designs can explicitly undo loser transactions. Do not describe one engine’s loser-handling technique as universal.


PostgreSQL Recovery Is Primarily REDO Plus Visibility Rules

WAL Reconstructs Data Pages

The physical effects are replayed from the redo point.

Uncommitted Tuples Are Not Made Visible Merely by Replay

Transaction status and MVCC determine whether those tuple versions count for readers. This is a critical distinction from systems whose crash algorithm performs a separate undo pass through the log.


ARIES-Style Recovery Uses Analysis, Redo and Undo

Classic ARIES Builds Recovery State

An analysis phase identifies dirty pages and active transactions.

Redo Repeats History, Then Undo Removes Loser Effects Logically

This is a useful general recovery architecture, but databases differ. The transferable lesson is that recovery must reconstruct durable committed outcomes and neutralise incomplete work according to the storage engine’s transaction representation.


Clean Shutdown and Crash Startup Are Different

Clean Shutdown Can Flush and Record a Consistent Stop

Restart has little or no crash replay work.

Crash Startup Assumes the Last Process Stopped Mid-Work

It validates recovery metadata and replays the required WAL. Testing only clean restarts does not exercise the crash-recovery path.


Immediate Shutdown Is a Useful Recovery Test in PostgreSQL

It Stops Without an Ordinary Clean Checkpoint

The next start performs crash recovery.

Use Only in a Disposable Test Environment

The purpose is to exercise WAL replay under controlled conditions. Production fault injection requires careful operational procedures and verified backups.


Recovery Time Depends on WAL Volume Since the Redo Boundary

More Records Usually Mean More Work

A long busy interval after the last checkpoint creates a larger replay stream.

But Bytes Are Not the Only Factor

Page reads, CPU decoding, full-page images, storage cache state and recovery prefetch all affect elapsed time. Measure the actual workload rather than inferring recovery duration from checkpoint age alone.


Recovery Prefetch Can Hide Page-Read Latency

Redo Often Knows Which Pages Will Be Needed Soon

The WAL stream describes upcoming changes.

PostgreSQL Can Ask the Kernel to Prefetch Recovery Pages

Its recovery_prefetch setting attempts to initiate reads ahead of the replay point on supported systems. This optimises recovery I/O but does not change recovery semantics.


A Base Backup Can Start From a Physically Inconsistent Moment

Pages Can Be Copied While the Database Is Running

Different files can reflect different instants.

WAL Replay Reconciles the Backup

PostgreSQL’s WAL introduction explains that an online physical backup can be made over a period, then WAL for that period fixes internal inconsistencies during restore. Recovery turns a moving physical copy into a consistent database image.


Point-in-Time Recovery Is Controlled Replay

Start From a Base Backup

The backup supplies a durable physical baseline.

Replay Archived WAL to a Target

The engine stops at a configured time, transaction, LSN or other supported target. This uses the same ordered recovery stream as crash recovery but intentionally stops before the latest available state.


Recovery and Standby Replay Share Mechanisms

A Physical Standby Replays WAL Continuously

It is essentially keeping another copy caught up through the same physical change stream.

Crash Recovery Is a Finite Catch-Up After Failure

Both depend on WAL correctness, but replication adds transport, delay and failover concerns that local crash recovery does not.


Recovery Can Expose a Database Only After Reaching a Consistent State

Early in Replay, Pages Can Be Mid-History

Queries would observe an incomplete reconstruction.

The Server Controls When Connections Are Allowed

Hot-standby modes define when read-only queries can run safely during continued replay. The boundary is part of the database protocol, not merely ‘the process is running’.


Recovery Progress Can Be Limited by Storage Headroom

WAL Segments Must Remain Available

A missing required segment can stop recovery.

Temporary Files and Restored Pages Need Space

Capacity planning should include data files, WAL, archived segments and any recovery-specific overhead. Running out of disk during recovery can turn an otherwise recoverable crash into a longer outage.


Corrupt WAL Is Different From End-of-WAL

A Clean End Means There Are No More Valid Records to Replay

Recovery can stop according to the protocol.

Corruption Means Required History May Be Missing or Damaged

The engine should surface an error rather than silently interpret arbitrary bytes as ‘nothing happened’. Reliable recovery distinguishes absence of more log from inability to trust the log.


Checksums Help Detect Corrupt Pages but Do Not Replace WAL

A Checksum Can Tell You the Page Is Damaged

It cannot by itself reconstruct the committed contents.

WAL or a Replica Provides Recovery Information

Integrity detection and recovery data are complementary. A page can pass a checksum and still be logically old; a page can fail a checksum and need restoration from WAL, backup or another copy.


The Control File Is a Critical Recovery Root

It Identifies Checkpoint and Cluster State

PostgreSQL’s pg_control provides the starting metadata used to locate the relevant checkpoint.

Small Critical Metadata Deserves Strong Protection

PostgreSQL’s WAL internals notes that pg_control is small and treated carefully. More generally, every recovery system has a small set of root metadata whose corruption can complicate discovery of the larger log history.


Recovery Must Honor the Same Comparator and Page Formats

WAL Records Are Interpreted Against Storage Structures

Indexes and relation pages have format expectations.

Software-Version Compatibility Matters

Upgrades and backups need supported migration paths. Replaying a WAL stream with incompatible binaries or page formats can be invalid even if the files are present. Follow the engine’s documented upgrade and restore procedures.


Crash Recovery Is Not Application-Level Compensation

The Database Restores Transactional Storage State

It does not unsend an email or reverse an external API call issued before the crash.

Applications Need Idempotency and Outbox Patterns for Cross-System Effects

A transaction that committed in the database but whose client did not receive the response creates ambiguity. Recovery can tell the database state; the application must reconcile external side effects safely.


The Ambiguous Commit Problem

A Client Can Lose the Connection After the Server Durably Commits

The client sees an error or timeout.

Retrying Blindly Can Duplicate Business Effects

Use idempotency keys, transaction identifiers or application-level reconciliation. WAL guarantees the database’s durable decision; it cannot guarantee the client learned that decision.


Recovery After Power Loss Tests the Whole Durability Stack

Operating-System Cache and Device Cache Matter

A database can issue the correct flush call but depend on hardware or virtualization honoring it.

A Realistic Test Is Stronger Than Process Kill Alone

Process termination leaves the operating system alive and may not simulate loss of volatile caches. Hardware-failure testing is more difficult and should be performed only in controlled environments designed for it.


Recovery After Kernel Panic Is Another Failure Class

The Database Process and OS Stop Together

Kernel page cache disappears.

Synchronous WAL Commit Is Designed to Survive the Promised Class of Crash

The exact guarantee still depends on storage stack correctness. Tests and vendor documentation should identify whether the target failure is process crash, OS crash, host loss or storage-device loss.


Recovery After Storage Failure May Need Backup or Replica

WAL on the Same Failed Device Can Be Lost Too

Local crash recovery cannot reconstruct what no surviving copy contains.

Failure Domains Matter

Separate WAL devices, archived WAL, physical backups and replicas protect different scopes. Do not describe WAL alone as protection from total device destruction.


Recovery and Replication Slots Can Interact Operationally

Slots Can Retain WAL Needed by Consumers

This protects lagging replicas or logical decoders.

During Outages, Retention Can Grow Rapidly

The recovery system may be healthy while disk usage becomes dangerous. Monitoring should include oldest retained positions and consumer lag, not only recovery replay speed.


Recovery Logs Are Evidence for Incident Analysis

Startup Usually Reports Recovery Progress and Completion

Those logs help identify whether crash replay occurred and where it started.

They Are Not a Substitute for Data Validation

A successful ‘recovery complete’ message proves the engine finished its protocol, not that the application made every intended business update. Compare logical invariants and transaction records after severe incidents.


Common Failure: Deleting WAL to Free Space Before Recovery

It Can Remove the Only Records Needed to Reconstruct Dirty Pages

The database may no longer start.

Let the Database Manage Segment Lifecycle

If disk is full, follow documented emergency procedures, preserve copies and identify why retention grew. Manual deletion inside WAL directories is a high-risk intervention.


Common Failure: Restoring Data Files Without Matching WAL

A Physical Backup Can Need Replay to Become Consistent

Copying table files alone is insufficient.

Restore the Whole Required Recovery Set

Use the engine’s supported base backup and WAL/archive procedures. Partial filesystem copying can produce a database that has individually readable files but no coherent recovery history.


Common Failure: Assuming Every Logged Change Must Be Visible After Recovery

Uncommitted Transactions Can Have WAL Records

Physical redo can reconstruct their page modifications.

Transaction Visibility Still Governs Logical Results

Readers should not see an incomplete transaction merely because recovery replayed low-level changes. This is where WAL and MVCC responsibilities meet.


Common Failure: Recovery Is Declared Successful Because the Server Accepts Connections

Structural Startup Is Only the First Layer

Indexes, constraints and application invariants still deserve checks after serious storage incidents.

Run Targeted Validation

Compare expected counts, high-value transaction IDs, replication state and application reconciliation records. The scope should match the severity of the failure and the business consequences.


A Recovery Test Matrix

Vary Failure Timing

Crash before commit, immediately after durable commit, during checkpoint, during index update and during bulk writeback.

Vary Failure Type

Process kill, immediate database stop, controlled host reboot and more realistic power-failure simulation where safe. Record which durability guarantees each test is intended to validate.


A Recovery Oracle

Maintain an Independent Record of Which Transactions Reached the Promised Commit Point

This can be a test harness log outside the database under controlled conditions.

After Restart, Compare Logical State

Every transaction that should survive must be represented; transactions that never reached the promised commit point must follow the engine’s documented semantics. The oracle turns recovery testing from visual inspection into a deterministic assertion.


Measure Recovery Time and Recovery Work Separately

Elapsed Time Is the User-Facing Metric

It determines outage duration.

WAL Bytes, Records Replayed and Pages Read Explain Why

Two recoveries can take the same time for different reasons. Collect enough telemetry to distinguish CPU decode, page-read latency and sheer log volume before tuning checkpoints or hardware.


Recovery Time Objectives Should Drive Checkpoint Policy

An RTO Is a Business Requirement

For example, the database must restart within a defined number of minutes.

Checkpoint Settings Are One Mechanism

Shorter intervals can reduce redo length but increase foreground I/O. Test the complete trade-off on production-like hardware instead of selecting checkpoint cadence from a generic rule.


Recovery Point Objectives Are About Data Loss, Not Restart Speed

Synchronous Local Commit Can Protect Recent Transactions From Local Crash

Subject to the storage contract.

Asynchronous Commit or Replication Delay Changes the RPO

A system can restart quickly and still lose recent acknowledged transactions if the durability mode allowed that. RTO and RPO must be measured separately.


Visual Analogy: Recovery Replays the Receipts Until the Shelves Match

Some Shelves Were Updated Before the Power Failed

Others were not.

The Receipt Stream Tells the Warehouse What Must Exist

Recovery checks each location, restores damaged bases when necessary and advances until the durable receipt history has been materialised again.


How the Parts Work Together: Recovery Is Reconciliation Between Promise and Matter

WAL Contains the Durable Decisions

Data pages are the materialised state.

A Crash Interrupts Materialisation, Not Necessarily the Decisions

Recovery reconciles the surviving pages with the durable decision stream. Checkpoints reduce how far back reconciliation must begin; transaction metadata decides which reconstructed versions are logically visible.


Frequently Asked Questions

Does Crash Recovery Always Undo Uncommitted Transactions?

Not in one universal algorithm. ARIES-style systems perform explicit undo of losers; PostgreSQL relies on redo plus transaction visibility/status so incomplete transactions remain invisible. Consult the engine’s recovery model.

Why Can Recovery Replay a Change From an Uncommitted Transaction?

Because physical page consistency and logical visibility are separate. Replaying history can restore page structure while transaction metadata keeps the uncommitted version hidden.


More Frequently Asked Questions

Can Recovery Start From the Latest Checkpoint and Ignore Everything Earlier?

It starts from the redo position defined by checkpoint metadata under the engine’s protocol. The exact location can precede the visible checkpoint record because pages dirtied earlier can still need replay.

Does a Successful Recovery Mean No Data Was Lost?

Only transactions covered by the configured durability contract are guaranteed. Asynchronous commit, failed replication or lost storage can change the amount of surviving data.


The Pillar Boundary and Sources

What This Article Owns

This pillar owns crash-recovery mechanics: checkpoint discovery, redo starting points, WAL replay, page-state checks, incomplete transaction treatment, recovery testing and RTO/RPO distinctions. Checkpoint generation and group commit have separate owners.

Sources and Further Reading

PostgreSQL 18’s WAL Internals explains recovery from pg_control and the checkpoint redo record. The WAL introduction explains REDO and online-backup recovery, while filesystem-level backup guidance explains why physical snapshots replay WAL after an unclean-style restore.


Final Synthesis: Recovery Makes the Data Files Catch Up With the Durable Decision Stream

The Mechanism

Find a trustworthy checkpoint, scan WAL forward, restore damaged page bases when necessary, reapply missing physical effects, respect transaction visibility for incomplete work and stop when the durable recovery stream has been reconciled.

Why It Works

WAL commit lets data pages lag during normal operation. Crash recovery is the mechanism that closes that lag after failure. Checkpoints bound the starting region, page WAL positions prevent duplicate effects, and transaction metadata separates physical replay from logical visibility.

Worked Recovery Trace: One Committed Transaction, One Incomplete Transaction

Suppose transaction A updates camera-2 and commits. Transaction B updates tripod-4 but the server crashes before B commits. WAL contains low-level records for both. Some pages from A and B may already have reached storage.

Recovery must restore physical page consistency using the WAL stream while preserving the logical distinction between A and B. A’s durable commit must survive. B’s incomplete work must not become visible merely because some of its page changes were replayed. This is the clearest example of the boundary between physical REDO and transaction visibility.

Worked Page-LSN Trace

Imagine page P survived with page LSN 900. Recovery encounters WAL records for P at 850, 900, 940 and 970. The first two effects are already represented at or before the page’s surviving position; later ones still need consideration.

The exact replay rule depends on the engine and WAL record type, but the principle is powerful: recovery can identify whether a page is behind the log instead of blindly reapplying every historical operation. Position-aware replay makes restart proportional to the gap rather than the database’s entire lifetime.

Worked Torn-Page Trace

Suppose a page write begins, power fails halfway, and the disk contains a mixture of old and new sectors. A page LSN inside the damaged page might not be trustworthy enough to reconstruct the intended image.

PostgreSQL’s full-page-write mechanism provides a complete page image after a checkpoint so recovery can restore a known-consistent base. Later WAL records can then be applied. The general lesson is that redo needs a trustworthy starting page; partial physical writes require an additional protection mechanism.

Recovery Needs a Reliable End-of-Log Decision

At restart, the engine scans records until it reaches the end of valid WAL. The difference between “there are no more complete records” and “the next record is corrupt” matters.

A truncated final record caused by the crash can be an expected tail condition under the engine’s protocol. Corruption inside an earlier required segment is a different problem. Recovery should not silently translate unexpected corruption into ordinary end-of-log.

Recovery Can Be CPU-Bound

Large WAL volume is not only a storage-read problem. Recovery must decode records, locate pages, verify checksums, update memory structures and sometimes reconstruct full pages.

On fast NVMe storage, CPU can become a meaningful portion of replay time. Measure CPU saturation alongside WAL bytes and page-read latency before assuming recovery requires a faster disk.

Recovery Can Be Random-Read Bound

WAL itself is sequential, but applying it can touch data pages scattered across many relation files. If the buffer cache is cold after restart, replay can trigger random reads.

PostgreSQL’s recovery_prefetch exists for this reason: the engine can look ahead in WAL and ask the operating system to fetch pages before they are needed. The optimisation attacks page-read latency without changing recovery correctness.

Recovery Can Be Write-Bound Too

Redo modifies buffers. Eventually those recovered pages need durable writeback as the server establishes a consistent running state and later checkpoints occur.

A recovery benchmark should therefore monitor reads, writes and synchronization, not only WAL scan rate. The slowest stage can shift as recovery progresses.

Recovery Progress Is Not Always Linear

A segment containing many records for pages already in cache can replay quickly. Another segment can trigger large full-page restores or random page reads. Equal WAL byte ranges can therefore take very different times.

Progress bars based only on byte position are useful but not perfect predictors of remaining time. Incident response should expect workload-dependent variability.

Crash Recovery and Point-in-Time Recovery Share Replay but Differ in Intent

Crash recovery replays enough WAL to reach the latest durable local state after an unclean stop. Point-in-time recovery begins from a backup and intentionally stops at a chosen target within archived WAL.

The same underlying record stream can therefore serve two jobs: repair an interrupted server or reconstruct a historical state. Target selection, archive availability and base-backup consistency distinguish the workflows.

Standby Replay Is Continuous Recovery

A physical standby receives WAL from the primary and applies it over time. Conceptually, it performs the same kind of redo that crash recovery performs after restart, but continuously as new records arrive.

This is why WAL replay position matters for replication lag and why recovery code quality affects both failover architecture and local restart behavior.

Recovery Consistency Does Not Prove Application Consistency

The database can successfully restore every committed transaction and still contain a business-state error that the application itself committed before the crash.

Crash recovery preserves transactional storage semantics; it does not judge whether a user transferred money to the wrong account or an application violated a business rule. Incident validation should separate database recovery correctness from application reconciliation.

The Client Can Be Uncertain Even When the Database Is Certain

A transaction can durably commit, then the network connection can fail before the success response reaches the client. After restart or reconnect, the server knows the transaction committed; the client might only know that its request ended ambiguously.

Idempotency keys, unique business identifiers or transaction-status queries help resolve this ambiguity. WAL guarantees the database state, not message delivery to the caller.

Recovery Testing Should Include Indexes

A row can appear correct while an index page is missing the corresponding entry. Crash recovery must restore all WAL-logged structures consistently.

Tests should query through indexes, perform index consistency checks where available, and compare indexed and sequential access paths. Row counts alone do not prove index recovery.

Recovery Testing Should Include DDL

Table creation, relation extension, index creation and other structural operations generate recovery obligations beyond ordinary row updates.

Include representative schema operations in controlled crash tests. A database whose row updates recover correctly can still have bugs or operational surprises around large structural changes.

Recovery Testing Should Include Large Transactions

A large transaction can generate significant WAL before committing. Crashing immediately before commit and immediately after durable commit exercises opposite outcomes over a large physical change set.

This is useful for verifying that incomplete work remains invisible while committed work survives, even when many pages and indexes were touched.

Recovery Testing Should Include Checkpoint Boundaries

Crash once shortly before a checkpoint, once during checkpoint writeback and once immediately after completion. The amount of WAL replay and page state differs across these points.

Comparing them verifies that the redo boundary advances safely and that a checkpoint is not published before its storage obligations are met.

Recovery Logs Should Be Preserved During Incidents

Startup logs can reveal the checkpoint location, redo start, recovery progress, missing segments, corruption and completion. Save them before rotating or restarting repeatedly.

Repeated restart attempts can change surrounding evidence or produce secondary errors. Preserve the first failure context whenever possible, especially before making manual filesystem changes.

Manual WAL Surgery Is a Last-Resort Operation

Deleting, renaming or fabricating WAL segments can destroy the only durable record of committed changes. Emergency utilities that reset WAL state exist for extreme cases, but their documentation normally warns of potential data loss and the need for subsequent dump/rebuild or validation.

Prefer restoring from a known-good backup or replica when the recovery log itself is irreparably damaged. Do not treat low-level reset tools as routine space-reclamation commands.

A Recovery Readiness Checklist

Know the last successful base backup, WAL/archive retention window, replication lag, current durability mode, normal checkpoint cadence, typical crash-recovery time, free disk headroom, failover procedure and the application reconciliation steps for ambiguous commits.

Then rehearse the procedure. A recovery plan that exists only as documentation but has never been executed under controlled conditions is still an untested hypothesis.

A Post-Recovery Validation Checklist

Verify database startup completed normally, replicas are consistent, high-value tables have expected counts, recent transaction identifiers reconcile, critical indexes answer correctly, background maintenance resumed, WAL retention returned to normal and application health checks pass.

For severe incidents, compare external systems such as payment processors or message queues against database records to resolve ambiguous cross-system actions. Recovery completes the database’s storage protocol; service restoration may require broader reconciliation.

Recovery Review: RPO and RTO Must Be Tested Together

Recovery point objective asks how much recent data can be lost. Recovery time objective asks how long service can remain unavailable. Synchronous local WAL can improve RPO while long redo horizons hurt RTO. Frequent checkpoints can improve RTO while increasing normal I/O.

A complete recovery test records both. Measure which committed transactions survive and how long restart takes. A server that returns in ten seconds after losing five minutes of acknowledged work and a server that preserves everything but takes forty minutes to start satisfy very different business contracts.

Recovery Review: Backups Need Replay Practice

A physical backup plus archived WAL is only useful if operators can restore the base image, supply the required segments, configure the target and verify the resulting database. Archive existence alone is not proof of recoverability.

Regular restore drills should include a target near the beginning, middle and end of the retained WAL window. This checks both archive continuity and operational knowledge. Recovery is a workflow, not merely a collection of files.

Recovery Review: Preserve the First Failure Evidence

During a real incident, copy logs, control-file diagnostics and storage errors before repeated intervention where practical. The first startup attempt often contains the clearest evidence of the original failure.

Then choose the least destructive recovery path. If a healthy replica or backup exists, restoring from a known-good source can be safer than low-level manipulation of WAL or control metadata. Recovery engineering should maximize trustworthy evidence before changing the damaged state.

Recovery Postconditions

After recovery, every transaction covered by the durability contract must have the logical effect the database promises, incomplete transactions must follow the engine’s loser-handling rules, data and index structures must be mutually consistent, and the server must have a new trustworthy point from which normal checkpointing can continue.

These conditions are stronger than “the process started.” A serious recovery test should validate recent committed identifiers, critical indexes, replication state and application invariants. The restart mechanism reconstructs storage; operational verification establishes that the service is safe to return to users.

Recovery Operations Checklist

Keep a tested base backup, verify WAL/archive continuity, know the oldest and newest recoverable points, rehearse failover, record expected recovery throughput and preserve enough free disk space for replay. For application recovery, also document how ambiguous commits are reconciled with external systems.

A recovery mechanism becomes dependable only when the organization can execute it under pressure. Technical correctness, operational evidence and application reconciliation form one recovery system.

A final recovery principle is to preserve evidence before intervention. WAL, control metadata, startup logs, backups and replicas can each explain part of the failure. Destructive low-level changes can remove that evidence. Prefer supported recovery paths, copy damaged state when practical, and validate the restored logical database before resuming normal traffic.

Recovery is complete only when the reconstructed database is both structurally usable and logically trustworthy under the engine’s transaction rules.


Continue the WAL Series

How Write-Ahead Logging Works · How Database Checkpoints Work · How Group Commit Works · How X Works Hub