pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Joseph Krogh <andreas@visena.com>
To: hubert depesz lubaczewski <depesz@depesz.com>
Cc: W.P. <laurentp@wp.pl>
Cc: pgsql-general mailing list <pgsql-general@postgresql.org>
Subject: Re: Hot backup in PostgreSQL
Date: Thu, 22 Oct 2020 11:04:47 +0200 (CEST)
Message-ID: <VisenaEmail.36.d59f54ce17aad18e.1754f74bd36@tc7-visena> (raw)
In-Reply-To: <20201022081812.GA4030@depesz.com>
References: <486ad2c5-01e0-fbf7-b09d-88898b28cdb0@wp.pl>
	<20201022073517.GA22554@depesz.com>
	<17611fd6-ab17-793a-3bf9-74bfb719a1eb@wp.pl>
	<20201022081812.GA4030@depesz.com>


På torsdag 22. oktober 2020 kl. 10:18:12, skrev hubert depesz lubaczewski <
depesz@depesz.com <mailto:depesz@depesz.com>>: 
On Thu, Oct 22, 2020 at 09:45:36AM +0200, W.P. wrote:
 > > There are many ways to do it. To be able to suggest proper solution we'd
 > > need to know:
 > > 1. what is the problem with pg_dump?
 > Time (I guess a bit, but copying files could be done using rsync, so much
 > faster).

 Is it *really* too slow for you? Please note that you can easily make it
 much faster by doing -Fd -j $( nproc ). 

I got curious and tried with this DB: 

andreak@[local]:5433 13.0 visena=# select 
pg_size_pretty(pg_database_size(current_database()));
 ┌────────────────┐
 │ pg_size_pretty │
 ├────────────────┤
 │ 47 GB │
 └────────────────┘
 (1 row)


nproc=16


Regular pg_dump: 

$ time pg_dump -O -d visena > ~/data/visena/visena.dmp

 real 2m43,904s
 user 0m10,135s
 sys 0m24,260s 


Parallell pg_dump: 

$ time pg_dump -OFd -j $(nproc) -f ~/data/visena/pg_backup -d visena 

 real 3m43,726s
 user 12m36,620s
 sys 0m9,537s


pg_dump with pbzip2 

$ time pg_dump -O -d visena | pbzip2 -c > ~/data/visena/visena.dmp.bz2 

 real 6m58,741s
 user 92m4,833s
 sys 2m18,565s 

Here are the sizes of all: 

7,4G pg_backup (directory with -Fd)
32G visena.dmp 
 5,8G visena.dmp.bz2 

-- 

Andreas Joseph Krogh 
CTO / Partner - Visena AS 
Mobile: +47 909 56 963 
andreas@visena.com <mailto:andreas@visena.com> 
www.visena.com <https://www.visena.com; 
 <https://www.visena.com; 

view thread (9+ messages)  latest in thread

Message-ID: <VisenaEmail.36.d59f54ce17aad18e.1754f74bd36@tc7-visena>
Permalink:  ../VisenaEmail.36.d59f54ce17aad18e.1754f74bd36@tc7-visena/
Also on:    postgresql.org/message-id/VisenaEmail.36.d59f54ce17aad18e.1754f74bd36@tc7-visena

 · 

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: andreas@visena.com, depesz@depesz.com, laurentp@wp.pl
  Subject: Re: Hot backup in PostgreSQL
  In-Reply-To: <VisenaEmail.36.d59f54ce17aad18e.1754f74bd36@tc7-visena>
  References: <486ad2c5-01e0-fbf7-b09d-88898b28cdb0@wp.pl> <20201022073517.GA22554@depesz.com> <17611fd6-ab17-793a-3bf9-74bfb719a1eb@wp.pl> <20201022081812.GA4030@depesz.com> <VisenaEmail.36.d59f54ce17aad18e.1754f74bd36@tc7-visena>

* 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