Re: Hot Standby query cancellation and Streaming Replication integration - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Hot Standby query cancellation and Streaming Replication integration
Date
Msg-id 1267581405.21887.603.camel@ebony
Whole thread Raw
In response to Hot Standby query cancellation and Streaming Replication integration  (Marc Munro <marc@bloodnok.com>)
List pgsql-hackers
On Tue, 2010-03-02 at 12:47 -0800, Marc Munro wrote:

> IIUC this is only a problem for WAL from HOT updates and vacuums.  If no
> vacuums or HOT updates have been performed, there is no risk of
> returning bad data.  So WAL that does not contain HOT updates or vacuums
> could be applied on the standby without risk, even if there are
> long-running queries in play.  This is not a complete solution but may
> reduce the likelihood of queries having to be cancelled.  I guess the
> approach here would be to check WAL before applying it, and only cancel
> queries if the WAL contains HOT updates or vacuums.

That's what we do.

> Taking the idea further, if WAL records contained the tid of the latest
> tuples that were overwritten, even more WAL could be applied without
> having to cancel queries.
> 
> To take it further still, if vacuum on the master could be prevented
> from touching records that are less than max_standby_delay seconds old,
> it would be safe to apply WAL from the very latest vacuum.  I guess HOT
> could be handled similarly though that may eliminate much of the
> advantage of HOT updates.

Thanks for your ideas.

-- Simon Riggs           www.2ndQuadrant.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Placement of block label in plpgsql block with DECLARE
Next
From: Andrew Dunstan
Date:
Subject: Re: plperl _init settings