Re: cancelled queries on standby - Mailing list pgsql-admin

From Greg Smith
Subject Re: cancelled queries on standby
Date
Msg-id 4EC2CDE2.3000400@2ndQuadrant.com
Whole thread Raw
In response to cancelled queries on standby  (MirrorX <mirrorx@gmail.com>)
Responses Re: cancelled queries on standby  (MirrorX <mirrorx@gmail.com>)
List pgsql-admin
On 11/15/2011 05:46 AM, MirrorX wrote:
> i am facing an issue concerning cancelled queries made on a hot standby
> server. if we suppose that there are some tables that are never changed (no
> inserts/updates/deletes) and that autovacuum is set to false for these
> tables, what else could there be affecting these tables and consequently
> cancelling my queries? thx in advance for any suggestions
>

Query cancellation isn't targeted this way.  Whether or not a query
needs to be canceled by vacuum cleanup depends on whether any open
transaction can see the rows that are being cleaned up.  I think you
have the understandable belief what rows are actually being viewed by
the query running on the standby matter; they don't.

Let's say you have a long-running query Q accessing a table A on the
standby.  Then some vacuum cleanup of table B happens on the master.  Q
can then be canceled when those cleanup records are replicated.  The
fact that A is never changed and doesn't have autovacuum enabled doesn't
matter.  Because it's possible for Q to see B, it's canceled regardless
of whether it's looked at it yet.

--
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us


pgsql-admin by date:

Previous
From: Cédric Villemain
Date:
Subject: Re: rsync and streaming replication
Next
From: MirrorX
Date:
Subject: Re: cancelled queries on standby