Re: Backup/Restore of single table in multi TB database

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "John Smith" <sodgodofall(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Backup/Restore of single table in multi TB database
Date: 2008-05-07 21:41:01
Message-ID: 19037.1210196461@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

"John Smith" <sodgodofall(at)gmail(dot)com> writes:
> 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

Yes: it will not work, not even a little bit, because the WAL files will
contain updates for all the tables. You can't just not have the tables
there during restore.

Why are you not using pg_dump?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2008-05-07 21:42:21 Re: pg_dumpall: pg_conversion table not saved
Previous Message Bruce Momjian 2008-05-07 21:38:50 Re: [GENERAL] pgbench not setting scale size correctly?

Browse pgsql-performance by date

  From Date Subject
Next Message John Smith 2008-05-07 22:24:22 Re: Backup/Restore of single table in multi TB database
Previous Message Simon Riggs 2008-05-07 21:28:44 Re: Backup/Restore of single table in multi TB database