pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael.paquier@gmail.com>
To: Tiffany Thang <tiffanythang@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Replication questions - read-only and temporary read/write slaves
Date: Thu, 4 Jan 2018 13:52:17 +0900
Message-ID: <20180104045217.GB1218@paquier.xyz> (raw)
In-Reply-To: <CAB_W-NMAMEHG4qaF2qV9DRLPxUpov5kazgL7ckGG4Emza5AtHQ@mail.gmail.com>
References: <CAB_W-NMAMEHG4qaF2qV9DRLPxUpov5kazgL7ckGG4Emza5AtHQ@mail.gmail.com>

On Fri, Dec 15, 2017 at 12:03:08PM -0500, Tiffany Thang wrote:
> 1. set up a read-only slave database? The closest solution I could find is
> Hot Standby but the slave would not be accessible until after a
> failover.

That's what the parameter hot_standby is for in recovery.conf. When a
server is in recovery mode and once it has reached a consistent point,
then it can be accessed for read-only queries if this parameter is
enabled. You need to be careful about how you want to handle replication
conflicts though, particularly if you have long read-queries on
standbys, which can be tuned with hot_standby_feedback. Be careful
though to not bloat too much the primary: retaining a XID horizon older
causes tables to retain more past versions of tuples, which costs in
space as well as in future VACUUM cleanups.

> 2. temporary convert a read-only slave in read-write mode for testing
> read/write workloads? Currently in Oracle, we can temporary open our
> read-only standby database in read-write mode to occasionally test our
> read-write workloads. We would stop the log apply on the standby database,
> convert the read-only database to read-write,
> perform our read/write test, discard all the changes after testing and
> reopen and resync the standby database in read-only mode. Is there a
> similar feature in PostgreSQL or are there ways to achieve something close
> to our needs?

Unfortunately not. You could reach the same kind of behavior by
promoting a standby, and then do your testing. Then you would need to
re-create a standby from scratch. What does "discard all the changes"
mean?
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (9+ messages)  latest in thread

Message-ID: <20180104045217.GB1218@paquier.xyz>
Permalink:  ../20180104045217.GB1218@paquier.xyz/
Also on:    postgresql.org/message-id/20180104045217.GB1218@paquier.xyz

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: michael.paquier@gmail.com, tiffanythang@gmail.com
  Subject: Re: Replication questions - read-only and temporary read/write slaves
  In-Reply-To: <20180104045217.GB1218@paquier.xyz>
  References: <CAB_W-NMAMEHG4qaF2qV9DRLPxUpov5kazgL7ckGG4Emza5AtHQ@mail.gmail.com> <20180104045217.GB1218@paquier.xyz>

* 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