PostgreSQL ERROR: canceling statement due to conflict with recovery

后端 未结 8 837
盖世英雄少女心
盖世英雄少女心 2020-12-02 04:22

I\'m getting the following error when running a query on a PostgreSQL db in standby mode. The query that causes the error works fine for 1 month but when you query for more

8条回答
  •  粉色の甜心
    2020-12-02 05:12

    There's no need to start idle transactions on the master. In postgresql-9.1 the most direct way to solve this problem is by setting

    hot_standby_feedback = on
    

    This will make the master aware of long-running queries. From the docs:

    The first option is to set the parameter hot_standby_feedback, which prevents VACUUM from removing recently-dead rows and so cleanup conflicts do not occur.

    Why isn't this the default? This parameter was added after the initial implementation and it's the only way that a standby can affect a master.

提交回复
热议问题