pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Raghavendra Rao J S V <raghavendrajsv@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: pg_basebackup is taking more time than expected
Date: Fri, 12 Jan 2018 08:07:54 -0500
Message-ID: <20180112130754.GF2416@tamriel.snowman.net> (raw)
In-Reply-To: <CAEHH7R4=_GN+LSsj0YZOXZ13yc=Gk9umJOLNopjS=imK0c1mWA@mail.gmail.com>
References: <CAEHH7R4=_GN+LSsj0YZOXZ13yc=Gk9umJOLNopjS=imK0c1mWA@mail.gmail.com>

Greetings,

* Raghavendra Rao J S V (raghavendrajsv@gmail.com) wrote:
> We have database with the size of *425GB*. Out of this 425 GB, Around 40 to
> 60% of space occupied by the indexes. Ram allocated to this machine is
> 32GB  and configuration parameters below.
[...]
> In order to take the backup of the database we are using pg_basebackup
> utility. But it is taking several hours (Around 18hours). Please guide me
> what are the configuration parameters need to modify to reduce the time
> taken by the pg_basebackup utility.

Unfortunately, there aren't a lot of great options with pg_basebackup,
but part of the question is- why is it taking so long?  That looks to be
a rate of less than 60Mb/s, assuming I did my calculations right, and
that's pretty slow.  How are you running pg_basebackup?  If you're doing
compression and the pg_basebackup process is consistently at 100% then
that's just the rate which a single CPU can compress data for you.  If
you're running the pg_basebackup across a WAN, then perhaps the
throughput available is only 60Mb/s.

> Is there any possibility to exclude the index data while taking the
> pg_basebackup?

This isn't currently possible, no, and it would seriously increase the
time required to restore the system.  If you aren't concerned about
restore time at all (though, really, you probably should be) then you
could consider using pg_dump instead, which can be run in parallel and
wouldn't include the indexes.  The format is a logical point-in-time
dump though, so you aren't able to do point-in-time recovery (playing
WAL forward) and reloading the data and rebuilding the indexes will take
quite a while.

Lastly, if the issue is that pg_basebackup is single-threaded, or that
you need multiple TCP connections to get higher throughput, then you
should consider one of the alternative physical (file-based) backup
solutions available for PostgreSQL, e.g.: pgBackRest, barman, or WAL-G.

Thanks!

Stephen

Attachments:

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

view thread (10+ messages)  latest in thread

Message-ID: <20180112130754.GF2416@tamriel.snowman.net>
Permalink:  ../20180112130754.GF2416@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20180112130754.GF2416@tamriel.snowman.net

 · 

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: sfrost@snowman.net, raghavendrajsv@gmail.com
  Subject: Re: pg_basebackup is taking more time than expected
  In-Reply-To: <20180112130754.GF2416@tamriel.snowman.net>
  References: <CAEHH7R4=_GN+LSsj0YZOXZ13yc=Gk9umJOLNopjS=imK0c1mWA@mail.gmail.com> <20180112130754.GF2416@tamriel.snowman.net>

* 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