In my replication servers on a postgresql master-slave replication scheme on aws RDS I get the following error:
SQLSTATE: Serialization failure: 7 ERROR: canceling statement due to conflict with recovery
The cause, as far as I understood is that the replication happens simirary like a database migration. A sequence of queries is written something called WAL and then are being executed in a FIFO sequence.
Also, I understood that once you execute queries whilst wal is being executed it can cause conflicts because sometimes the query that is currently is being executed can cause fetching stale data.
So according to documentation there are delays that allow first the current queries to be executed and then apply wal changes. Theese are:
But setting these values as -1 on heavy queries (query execution time >30s) will cause the replicas to have stale data for extended period of times?