Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id DE0F42E00F5 for ; Tue, 4 Dec 2007 07:19:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 91595-07 for ; Tue, 4 Dec 2007 07:19:10 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by postgresql.org (Postfix) with ESMTP id 58E732E0045 for ; Tue, 4 Dec 2007 07:19:20 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.1/8.14.1) with ESMTP id lB4BJ9Dq092940 for ; Tue, 4 Dec 2007 07:19:10 -0400 (AST) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.1/8.14.1/Submit) id lB4BGdXR092682 for pgsql-admin@postgresql.org; Tue, 4 Dec 2007 07:16:39 -0400 (AST) (envelope-from news) From: Aldor X-Newsgroups: pgsql.admin Subject: Re: Is there an easy and safe way to migrate a database to a new tablespace? Date: Tue, 04 Dec 2007 12:16:21 +0100 Organization: Hub.Org Networking Services Lines: 26 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) In-Reply-To: To: pgsql-admin@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/13 X-Sequence-Number: 27530 Get the oid of your old tablespace: select oid from pg_tablespace where spcname = '[OLDTABLESPACE]'; Get your tables from the old tablespace: select select relname from pg_class where pc.reltablespace = [TABLESPACEOID] ----optional---- and relkind = 'r' ; With "ALTER TABLE [TABLE] SET TABLESPACE [TABLESPACENAME];" you can move your tables to the new destination. Scott Marlowe wrote: > On Nov 26, 2007 3:05 PM, David Young wrote: >> Hi, >> >> I recently converted to using a postgresql engine that support tablespaces. >> There's a database that I would like to move to a new tablespace for >> performance reasons. What is the safe and correct way of doing this? The >> documentation is a bit sketchy on this.