Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TvywU-0001oj-CI for pgsql-admin@arkaria.postgresql.org; Thu, 17 Jan 2013 23:32:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TvywT-0003rY-TV for pgsql-admin@arkaria.postgresql.org; Thu, 17 Jan 2013 23:32:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TvywT-0003rT-8a for pgsql-admin@postgresql.org; Thu, 17 Jan 2013 23:32:17 +0000 Received: from mout.gmx.net ([74.208.4.201]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TvywR-0005p0-Ac for pgsql-admin@postgresql.org; Thu, 17 Jan 2013 23:32:16 +0000 Received: from mailout-us.gmx.com ([172.19.198.46]) by mrigmx.server.lan (mrigmxus002) with ESMTP (Nemesis) id 0Lqkly-1TIodI0gza-00eOSD for ; Fri, 18 Jan 2013 00:32:14 +0100 Received: (qmail 6514 invoked by uid 0); 17 Jan 2013 23:32:13 -0000 Received: from 76.255.19.161 by rms-us013 with HTTP Content-Type: text/plain; charset="utf-8" Date: Thu, 17 Jan 2013 18:32:11 -0500 From: "Kevin Grittner" Message-ID: <20130117233212.134360@gmx.com> MIME-Version: 1.0 Subject: Re: Question concerning replicated server using streaming replication used as a read-only reporting server To: "Benjamin Krajmalnik" ,pgsql-admin@postgresql.org X-Authenticated: #138763884 X-Flags: 0001 X-Mailer: GMX.com Web Mailer x-registered: 0 Content-Transfer-Encoding: 8bit X-GMX-UID: q+yKcBhV3zOlOQ09Lnwhk91+IGRvb8CB X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Benjamin Krajmalnik wrote: > I have 2 servers which are using streaming replication (pg 9.0.4). > > The secondary server is there primarily as a disaster recovery server, > but we are also using it for reporting, so as not to place undue load on > the primary server. > > As I review the logs on the secondary server, I frequently see the > following: > 2013-01-17 06:05:47 MST [local]ERROR: canceling statement due to > conflict with recovery > 2013-01-17 06:05:47 MST [local]DETAIL: User query might have needed to > see row versions that must be removed. > 2013-01-17 06:05:47 MST [local]STATEMENT: Select statement goes here > 2013-01-17 06:05:47 MST [local]FATAL: terminating connection due to > conflict with recovery > 2013-01-17 06:05:47 MST [local]DETAIL: User query might have needed to > see row versions that must be removed. > 2013-01-17 06:05:47 MST [local]HINT: In a moment you should be able to > reconnect to the database and repeat your command. > Is there anything that can be done to mitigate this situation? You need to decide how "stale" you're willing to let the hot standby get. To preserve an image of the database which can allow the query to keep running, the standby server might need to pause replay of transactions. To allow long transactions, you need to allow it to pause the transaction stream for a long time, but that means that it's getting out of date for disaster recovery purposes. It might be worthwhile to keep two standby clusters, one that is aggressive about applying the latest transactions, and another which allows long-running queries. -Kevin -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin