Re: cancelled queries on standby

From: Greg Smith <greg(at)2ndQuadrant(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: cancelled queries on standby
Date: 2011-11-15 20:38:58
Message-ID: 4EC2CDE2.3000400@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)2ndQuadrant(dot)com Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message MirrorX 2011-11-15 22:09:28 Re: cancelled queries on standby
Previous Message Cédric Villemain 2011-11-15 20:31:38 Re: rsync and streaming replication