PostgreSQL PITR recovery

A PostgreSQL WAL archive gap prevents point-in-time recovery from advancing beyond the missing sequence.

Point-in-time recovery begins with a base backup and replays an unbroken sequence of write-ahead log records. One missing segment, wrong timeline, partial file, or mismatched base backup can stop recovery before the desired transaction time.

Understand the symptom

PITR requires a continuous WAL path from the backup checkpoint to the target.

WHY

What is happening

WAL segments encode ordered changes. Recovery can switch timelines after promotion, but history files identify ancestry; a later segment cannot substitute for a missing earlier one, and another server's similarly named file may belong to a different system.

What you may see

Symptoms that change the recovery path.

01

Requested WAL segment not found

Recovery stops while archive retrieval cannot supply the next file.

02

Invalid checkpoint or system identifier

The base backup and WAL source do not belong together.

03

Recovery follows the wrong timeline

Promotion history or target settings do not match the intended branch.

04

Replica has extra WAL

A standby or old pg_wal directory may retain the missing segment.

Protect the source

Actions that can make the situation worse.

01

pg_resetwal breaks continuity

It can make a cluster start without making prior transactions consistent.

02

Promotion creates a new timeline

It changes the recovery branch and may recycle useful files.

03

Archive cleanup removes unique segments

Retention jobs can destroy the only complete path.

Do this now

Safe steps before evaluation.

01

Freeze archive retention

Stop cleanup, expiration, and recycling on every WAL source.

02

Inventory all copies

Search archives, replicas, object versions, backups, and old pg_wal directories by system identity.

03

Preserve timeline and manifest files

Keep history, labels, checksums, and recovery logs with the base backup.

04

Clone before retrying

Run recovery experiments on complete copies, not the only source.

NEPFOSYS process

How a data-first evaluation proceeds.

01

Backup and timeline mapping

NEPFOSYS correlates base backup identity, WAL sequence, targets, and branches.

02

Gap-source preservation

Candidate archives, replicas, and partial segments are copied before cleanup.

03

Isolated recovery validation

The farthest consistent point is restored and application data is checked separately.

A clear next step

Preserve the original device before another repair or recovery attempt.

Start a case with the exact symptoms, incident timeline, prior attempts, encryption details, and the files that matter most. NEPFOSYS will route the case to the appropriate DFW intake or nationwide mail-in path.

Start with a case review

Questions, answered

What customers ask before starting.

Can PostgreSQL skip one missing WAL segment?

No. Later changes depend on the ordered record stream before them.

Can a replica contain the missing segment?

Yes. Preserve standbys and their pg_wal directories before promotion or cleanup.

Should I use pg_resetwal?

Not as a PITR recovery method; it cannot recreate missing transactions and changes cluster state.

DFW local · Nationwide mail-in

Protect the device. Start with the facts.

Start my recovery case