Re: PG_RESTORE and database size

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Marcus Couto" <marcus_couto(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PG_RESTORE and database size
Date: 2006-01-27 15:32:34
Message-ID: 2453.1138375954@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Marcus Couto" <marcus_couto(at)hotmail(dot)com> writes:
> Here's a basic question. On working with backing up and restoring it =
> seems like if I keep on doing it in a row, the backup file size keeps on =
> increasing in size. It almost doubles in size for every backup/restore. =
> I want the restore the backup to overwrite the database and not add to =
> it. Is there another procedure I'm missing or a parameter I'm not using =
> right with pg_restore and pg_dump?

Why are you restoring into a live database? It sounds to me like you
are probably ignoring a lot of object-already-exists errors from
pg_restore and then having it add on duplicate data to the tables.

Usually people drop the database and recreate it empty before running
pg_restore. There is a switch named --clean or something like that
to make pg_restore emit DROP commands before recreating objects, but
hardly anyone uses it because it's usually slower than dropping the
whole database at once.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2006-01-27 15:53:38 Re: stats for failed transactions (was Re: [GENERAL] VACUUM Question)
Previous Message Tom Lane 2006-01-27 15:26:14 Re: Logging statements and parameter values