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

Re: empty a database

From: Dick Davies <rasputnik(at)hellooperator(dot)net>
To: PostgreSQL Admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: empty a database
Date: 2005-02-15 16:41:46
Message-ID: 20050215164146.GD63378@eris.tenfour (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
* Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> [0232 16:32]:
> Dick Davies <rasputnik(at)hellooperator(dot)net> writes:
> > Is there a neat way to clean out a database via SQL commands?
> > i.e. get rid of tables, sequences, integers, etc.
> > At present I'm using dropdb/createdb, but thats' far from ideal
> > and I think it's causing postgres to do more mork than it needs to...
> Well, if you put everything into one or a few schemas then dropping
> and recreating those schemas would do it.  I suspect though that this
> is *not* faster than dropdb/createdb.

Thanks Tom.

It's not just the speed, it's the constant deletes and creations in
~pgsql/data - as I said the other day, this is recreating a test db from the
production one as part of unit tests, so this happens dozens of times a day...

'...and then we wrote scripts to write the configs for us, and using
these scripts, we made mistakes in a faster, more automated manner.'
		-- A Gentle Introduction to Cricket, on MRTG configuration
Rasputin :: Jack of All Trades - Master of Nuns

In response to

pgsql-admin by date

Next:From: Naomi WalkerDate: 2005-02-15 17:24:41
Subject: Re: empty a database
Previous:From: Tom LaneDate: 2005-02-15 16:31:57
Subject: Re: empty a database

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