pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Emils Klotins <emils@dot.lv>
Cc: pgsql-sql@postgresql.org
Subject: Re: Backup?
Date: Tue, 27 Jun 2000 10:43:13 -0400
Message-ID: <9737.962116993@sss.pgh.pa.us> (raw)
In-Reply-To: <3958C38D.19942.24191291@localhost>
References: <3958C38D.19942.24191291@localhost>

"Emils Klotins" <emils@dot.lv> writes:
> Would it be possible to backup a db by just copying the dir struct 
> under the PG_DATA or must I absolutely use pg_dump?

If you ensure nothing at all is happening (as in "shut down the
postmaster" --- I would not trust any half measures) then a dump of
PGDATA would work.  If anything is going on then a dump done that way
will be inconsistent.

> As I understand pg_dump could be comparatively slower, plus it
> produces a text format dumpfile, which could be kind of large in my db
> in future.

pg_dump is slower, but since it can run in parallel with other
activities, I'm not sure that the extra time is a material
disadvantage.  I wouldn't assume that the text dumpfile will be
larger than a tar of the database directory either --- very likely
it'd be the other way round.  Finally, the text dump is amenable to
editing, selective restoration, etc, which you *cannot* do with
a directory dump --- the only thing a directory dump is good for is
restoring the entire DB to exactly where it was.

The main thing that makes a directory dump less useful than it might
appear to be is that the logical state of each table is split between
the table file proper (containing tuples marked with transaction
insert/delete stamps) and pg_log (which tells you which transactions
committed and which did not).  Thus you cannot restore just one
table file; you have to restore pg_log as well, and that makes it
an all-or-nothing proposition.

			regards, tom lane



view thread (10+ messages)  latest in thread

Message-ID: <9737.962116993@sss.pgh.pa.us>
Permalink:  ../9737.962116993@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9737.962116993@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, emils@dot.lv
  Subject: Re: Backup?
  In-Reply-To: <9737.962116993@sss.pgh.pa.us>

* 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