Error: Canceling Statement Due to Conflict With Recovery
Issue
Connections fail with the following error:
ERROR: canceling statement due to conflict with recovery Detail: User query might have needed to see row versions that must be removed.
Environment
Connector: PostgreSQL
Resolution
To resolve this issue, set the hot_standby_feedback parameter to ON on the replica we're attempting to query. For more information, see the Replication section of the PostgreSQL Server Configuration documentation.
Cause
This issue occurs when we can't run a query on your replica because it references records that were deleted from your primary database.
Setting the hot_standby_feedback parameter to ON prevents the primary from vacuuming rows still needed by queries running on the replica.