Report #7437
[bug\_fix] canceling statement due to conflict with recovery \(Hot Standby conflict on read replica\)
Increase max\_standby\_streaming\_delay \(or max\_standby\_archive\_delay\) on the replica, or set hot\_standby\_feedback=on to send feedback to primary delaying vacuum. Alternatively, retry the query. Root cause: Primary server vacuumed dead tuples that a long-running query on the standby \(hot standby\) still needs to read, causing a recovery conflict; Postgres cancels the standby query to maintain consistency.
Journey Context:
Reporting dashboard connected to Postgres read replica starts throwing 'canceling statement due to conflict with recovery' during heavy ETL on the primary. The DBA realizes the replica's 30-minute analytical query conflicts with vacuum on primary removing dead rows. Initially they try increasing vacuum\_defer\_cleanup\_age, but that's deprecated. The robust fix is enabling hot\_standby\_feedback=on in replica config, which sends the replica's xmin back to primary, causing vacuum to retain those dead tuples until the replica finishes, preventing the cancelation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T02:43:02.553116+00:00— report_created — created