Skip site navigation (1) Skip section navigation (2)

Re: EMPTYING A DATABASE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: EMPTYING A DATABASE
Date: 2010-04-29 18:56:35
Message-ID: 17153.1272567395@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
"George Weaver" <gweaver(at)shaw(dot)ca> writes:
> From: "Tom Lane":
> My thought would be to make use of multi-table TRUNCATE, assuming
> he's using a PG version new enough to have that.  Keep a script
> around with a TRUNCATE that lists all of the related tables in one
> command, and just run the script to reset.

> Wouldn't using pg_dump with the schema only option accomplish this?

Sure.  I assume the OP already thought of that, and was curious
about alternatives.  (One possible reason to prefer the TRUNCATE
approach though: you don't necessarily have to zap *every* table
in the database.)

			regards, tom lane

In response to

pgsql-novice by date

Next:From: Tony DayDate: 2010-04-30 01:59:55
Subject: Long (really long) queries and not sure how to diagnose
Previous:From: George WeaverDate: 2010-04-29 18:21:06
Subject: Re: EMPTYING A DATABASE

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group