X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8F6438BA172 for ; Tue, 15 Feb 2005 16:41:51 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76687-10 for ; Tue, 15 Feb 2005 16:41:49 +0000 (GMT) Received: from 9.hellooperator.net (cpc3-cdif2-3-0-cust202.cdif.cable.ntl.com [81.103.32.202]) by svr1.postgresql.org (Postfix) with ESMTP id 7FB158BA165 for ; Tue, 15 Feb 2005 16:41:48 +0000 (GMT) Received: from [10.4.0.5] (helo=eris.tenfour) by 9.hellooperator.net with esmtp (Exim 4.43) id 1D15li-0005JB-Ol for pgsql-admin@postgresql.org; Tue, 15 Feb 2005 16:41:47 +0000 Received: from rasputnik by eris.tenfour with local (Exim 4.44 (FreeBSD)) id 1D15li-000EwV-MD for pgsql-admin@postgresql.org; Tue, 15 Feb 2005 16:41:46 +0000 Date: Tue, 15 Feb 2005 16:41:46 +0000 From: Dick Davies To: PostgreSQL Admin Subject: Re: empty a database Message-ID: <20050215164146.GD63378@eris.tenfour> Reply-To: Dick Davies References: <20050215155148.GZ63378@eris.tenfour> <12827.1108485117@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <12827.1108485117@sss.pgh.pa.us> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.518 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL X-Spam-Level: * X-Archive-Number: 200502/124 X-Sequence-Number: 16292 * Tom Lane [0232 16:32]: > Dick Davies 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