Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZz3z-0001RZ-OH for pgsql-general@arkaria.postgresql.org; Fri, 12 Jan 2018 13:08:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZz3y-0004hK-OP for pgsql-general@arkaria.postgresql.org; Fri, 12 Jan 2018 13:08:02 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eZz3y-0004hB-Dq for pgsql-general@lists.postgresql.org; Fri, 12 Jan 2018 13:08:02 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eZz3r-0003Dg-Nc for pgsql-general@lists.postgresql.org; Fri, 12 Jan 2018 13:08:00 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id BD3325F7A2; Fri, 12 Jan 2018 08:07:54 -0500 (EST) Date: Fri, 12 Jan 2018 08:07:54 -0500 From: Stephen Frost To: Raghavendra Rao J S V Cc: pgsql-general@lists.postgresql.org Subject: Re: pg_basebackup is taking more time than expected Message-ID: <20180112130754.GF2416@tamriel.snowman.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="i22HaqtxAPsLl0kR" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --i22HaqtxAPsLl0kR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --i22HaqtxAPsLl0kR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJaWLMqAAoJEO1sijiDR2RVSEYP/irnPNp4g1hJRtkC/EhkJYYc zCLWnjMoslSSAxTsOiJvUilOVdSx1enVy+51Rar+XXJr/s5xh96p0YrJPVo2/Rjl LwGrmOjg1rIsBr+dS/9XktN33DaCf8yIs0J0H+ZNjHWPy7fwKxx3z+OElVz0w0k8 YzSaEm1WAtASIGc0Y7lKhHW3hr1mgLk2+ocR2Z8N/68OVi+UpCb2ATE3S+bY0h9B 1f23A04LN2BHc13CSOR6BaD5BFRQfCVojNQkl8unsmmoAfvfCaNr5vO6vRm7Rq+K bxwRq6OdafAxP7MLyxuRY81qak+DZEqbIBAHE1y/ATsyvjmmXkiRqjFFTfn6tOfr c6EfjQ05tMrAHXhblPmUVL1u+sP952pM9eQLF4+Qi5axEyEYDhG0YBIaFvxuOcW7 mdbanPkDrYM0p8ayBqOkUFFd93Vn0V+tfadGZhVJJcurvnVmbULeXu3tci4T8oMP bSv9CwW4ybLzpoXyawzWnnGLMzvOqNc6V8r/amBM6ihX+ZTE14cJb+w29PgWlAVG HCYFAZgvhX7LZjVTg5yBXV2Dot8yH4QcDmw8utd8R3Nm1MSpCBAtOyQSZb/dheS6 zXGx+BYg5+XCwghMsQ2VsZJzPdZD7FSqG4+vQajCV2nIvdztZR/5PAJ4XiDGn/MJ GvhAvtY8YH1DlZxfuycU =jpR2 -----END PGP SIGNATURE----- --i22HaqtxAPsLl0kR--