From: John Smith <sodgodofall@gmail.com>
To: pgsql-general@postgresql.org
Subject: Backup/Restore of single table in multi TB database
Date: Wed, 7 May 2008 13:02:57 -0700
Message-ID: <b88f0d670805071302h469141e0ke29413edddb444e0@mail.gmail.com> (raw)
Hi,
I have a large database (multiple TBs) where I'd like to be able to do
a backup/restore of just a particular table (call it foo). Because
the database is large, the time for a full backup would be
prohibitive. Also, whatever backup mechanism we do use needs to keep
the system online (i.e., users must still be allowed to update table
foo while we're taking the backup).
After reading the documentation, it seems like the following might
work. Suppose the database has two tables foo and bar, and we're only
interested in backing up table foo:
1. Call pg_start_backup
2. Use the pg_class table in the catalog to get the data file names
for tables foo and bar.
3. Copy the system files and the data file for foo. Skip the data file for bar.
4. Call pg_stop_backup()
5. Copy WAL files generated between 1. and 4. to another location.
Later, if we want to restore the database somewhere with just table
foo, we just use postgres's normal recovery mechanism and point it at
the files we backed up in 2. and the WAL files from 5.
Does anyone see a problem with this approach (e.g., correctness,
performance, etc.)? Or is there perhaps an alternative approach using
some other postgresql mechanism that I'm not aware of?
Thanks!
- John
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-performance@postgresql.org
Cc: sodgodofall@gmail.com, pgsql-general@postgresql.org
Subject: Re: Backup/Restore of single table in multi TB database
In-Reply-To: <b88f0d670805071302h469141e0ke29413edddb444e0@mail.gmail.com>
References: <b88f0d670805071302h469141e0ke29413edddb444e0@mail.gmail.com>
* 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