Re: Backup taking long time !!!

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: julyanto SUTANDANG <julyanto(at)equnix(dot)co(dot)id>, Dinesh Chandra 12108 <Dinesh(dot)Chandra(at)cyient(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Backup taking long time !!!
Date: 2017-01-23 17:12:22
Message-ID: CAMkU=1x929ghAR9orvySuxhTGBZmwKABSjy36G=OCBOPsj4_kQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Sun, Jan 22, 2017 at 6:57 AM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:

> Greetings,
>
> * julyanto SUTANDANG (julyanto(at)equnix(dot)co(dot)id) wrote:
> > CORRECTION:
> >
> > "you might you pg_start_backup to tell the server not to write into the
> > DATADIR"
> >
> > become
> >
> > "you might *use* pg_start_backup to tell the server not to write into the
> > *BASEDIR*, actually server still writes but only to XLOGDIR "
>
> Just to make sure anyone reading the mailing list archives isn't
> confused, running pg_start_backup does *not* make PG stop writing to
> BASEDIR (or DATADIR, or anything, really). PG *will* continue to write
> data into BASEDIR after pg_start_backup has been called.
>

Correct. Unfortunately it is a very common myth that it does cause
PostgreSQL to stop writing to the base dir.

>
> The only thing that pg_start_backup does is identify an entry in the WAL
> stream, from which point all WAL must be replayed when restoring the
> backup. All WAL generated from that point (pg_start_backup point) until
> the pg_stop_backup point *must* be replayed when restoring the backup or
> the database will not be consistent.
>

pg_start_backup also forces full_page_writes to be effectively 'on' for the
duration of the backup, if it is not already explicitly on (which it
usually will already be). This affects pg_xlog, of course, not base. But
it is an essential step for people who run with full_page_writes=off, as it
ensures that anything in base which got changed mid-copy will be fixed up
during replay of the WAL.

Cheers,

Jeff

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Stephen Frost 2017-01-23 17:20:54 Re: Backup taking long time !!!
Previous Message Gabriel Dodan 2017-01-23 16:55:04 performance contradiction