pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Smith <greg@2ndQuadrant.com>
To: pgsql-admin@postgresql.org
Subject: Re: cancelled queries on standby
Date: Tue, 15 Nov 2011 15:38:58 -0500
Message-ID: <4EC2CDE2.3000400@2ndQuadrant.com> (raw)
In-Reply-To: <1321354003378-4994025.post@n5.nabble.com>
References: <1321354003378-4994025.post@n5.nabble.com>

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




view thread (3+ messages)  latest in thread

Message-ID: <4EC2CDE2.3000400@2ndQuadrant.com>
Permalink:  ../4EC2CDE2.3000400@2ndQuadrant.com/
Also on:    postgresql.org/message-id/4EC2CDE2.3000400@2ndQuadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: greg@2ndQuadrant.com
  Subject: Re: cancelled queries on standby
  In-Reply-To: <4EC2CDE2.3000400@2ndQuadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox