Parameter · Write-Ahead Log / Recovery Target
recovery_target_xid
Sets the transaction ID up to which recovery will proceed.
- Default:
'' (empty) - Type: string
- Applies: Restart required
In plain words
Stop recovery at a specific transaction. If you know the ID of the transaction that did the damage, set it here with recovery_target_inclusive = off to stop just before it.
For DBAs and operators
Transaction IDs are assigned at start but commit in a different order; replay stops when it reaches the commit (or abort) record of this XID. Only transactions that committed before it (and, with inclusive on, the target itself) are recovered: a transaction with a smaller XID that committed later is not. Find the XID with pg_waldump (look for the COMMIT following your DDL/DML) or from audit logs (%x in log_line_prefix).
Log on stop: LOG: recovery stopping before commit of transaction 744, time 2026-10-22 14:04:59+00
Only the 32-bit XID is compared: a 64-bit value that includes the epoch (as returned by pg_current_xact_id()) is cut down to its low 32 bits.
How to change it
Change in postgresql.conf or ALTER SYSTEM, then restart the server.
See it in context
Related parameters
recovery_target_inclusive recovery_target_time recovery_target_action