Re: backup and restore questions

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Sally Sally" <dedeb17(at)hotmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: backup and restore questions
Date: 2004-02-19 19:26:56
Message-ID: 200402191926.56857.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday 19 February 2004 17:41, Sally Sally wrote:
> I had a few questions
> concerning the backup/restore process for pg.

Please don't post HTML if you can avoid it.

> class=RTE>&nbsp;</DIV>
> <DIV class=RTE>1) Is it possible to dump&nbsp;data onto an existing
> database that contains data (assumning the schema of both are the same).
> Has anyone done this? I am thinking of this in order to expediate the data
> load process</DIV>

No reason why you can't copy the data in - assuming primary keys don't clash
of course.

> <DIV class=RTE>2) I read that when dumping and restoring data the insert
> option is safer but slower than copy? Does anyone know from experience how
> much slower (especially for a database containing millions of
> records).</DIV> <DIV class=RTE>&nbsp;</DIV>

It's not safer so much as more standard - any database can handle a series of
INSERT statements. Inserts are a lot slower.

> <DIV class=RTE>3) can pg_restore accept a file that is not archived like a
> zipped file or plain text file (file.gz or file)</DIV> <DIV

You can't restore a whole database. It's straightforward enough to use COPY or
\copy with psql to handle a simple tab (or whatever) separated file though.
If you want to unzip the file first, well, that's what scripting is for.

> <DIV class=RTE>4) Is the general practise to have one&nbsp;whole&nbsp;dump
> of a database or several separate dumps (by table etc...)?

Personally, I dump the data+schema in one file and the schema (again) in
another file. Makes it easy to scan through the schema. You can restore just
a single table from a full dump anyway - see the manuals for full details.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Rawnsley 2004-02-19 19:43:04 Re: Replication options
Previous Message Keary Suska 2004-02-19 18:52:47 Re: Select for update, locks and transaction levels