pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrus <kobruleht2@hot.ee>
To: pgsql-general <pgsql-general@postgresql.org>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Subject: Re: How to restore to empty database
Date: Fri, 31 Jan 2020 01:08:37 +0200
Message-ID: <332CC5FE386B4B86AAE5556896A635ED@dell2> (raw)
In-Reply-To: <8f1d29bd-907e-e1c5-cc5f-2b9cade5af19@aklaver.com>
References: <D3F14323F35F4DC4BA3E517ED11199E1@dell2>
	<8f1d29bd-907e-e1c5-cc5f-2b9cade5af19@aklaver.com>

Hi!

>You need to connect to a database that exists with --dbname, for
>instance --dbname=postgres. Postgres will then use that connection to
>create the new database, in your case mydb.

Thank you, this seems work.

There are total 24 databases, .backup files total size in 37GB , aprox 60 %
from this from bytea columns ( pdf documents, images).
Using VPS server, 4 cores, 11 GB RAM, used only for postgres.
Which is the fastest way to restore data from all of them to empty
databases. Should I run all commands in sequence like

pg_restore --clean --create --if-exists --verbose --dbname=postgres  --jobs=4
"database1.backup"
pg_restore --clean --create --if-exists --verbose --dbname=postgres  --jobs=4
"database2.backup"
...
pg_restore --clean --create --if-exists --verbose --dbname=postgres  --jobs=4
"database24.backup"

or run them all parallel without --jobs=4 like

pg_restore --clean --create --if-exists --verbose --dbname=postgres
"database1.backup" &
pg_restore --clean --create --if-exists --verbose --dbname=postgres
"database2.backup" &
...
pg_restore --clean --create --if-exists --verbose --dbname=postgres  --jobs=4
"database24.backup" &


or some balance between those ?
Is there some postgres or Debian setting which can used during restore time
to speed up restore ?
I use shared_buffers=1GB , other settings from debian installation.

Andrus. 






view thread (6+ messages)  latest in thread

Message-ID: <332CC5FE386B4B86AAE5556896A635ED@dell2>
Permalink:  ../332CC5FE386B4B86AAE5556896A635ED@dell2/
Also on:    postgresql.org/message-id/332CC5FE386B4B86AAE5556896A635ED@dell2

 · 

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: kobruleht2@hot.ee, adrian.klaver@aklaver.com
  Subject: Re: How to restore to empty database
  In-Reply-To: <332CC5FE386B4B86AAE5556896A635ED@dell2>
  References: <D3F14323F35F4DC4BA3E517ED11199E1@dell2> <8f1d29bd-907e-e1c5-cc5f-2b9cade5af19@aklaver.com> <332CC5FE386B4B86AAE5556896A635ED@dell2>

* 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