pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aldor <aldnin@yahoo.de>
To: pgsql-admin@postgresql.org
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
Message-ID: <fj3cum$2qg8$1@news.hub.org> (raw)
In-Reply-To: <dcc563d10712031322v5bf57efcj7060881beb67504a@mail.gmail.com>
References: <d3feac2a0711261305l33a4830bob6df418248338115@mail.gmail.com>
	<dcc563d10712031322v5bf57efcj7060881beb67504a@mail.gmail.com>

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 <randomfire@gmail.com> 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.



view thread (3+ messages)

Message-ID: <fj3cum$2qg8$1@news.hub.org>
Permalink:  ../fj3cum$2qg8$1@news.hub.org/
Also on:    postgresql.org/message-id/fj3cum$2qg8$1@news.hub.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: aldnin@yahoo.de
  Subject: Re: Is there an easy and safe way to migrate a database to a new tablespace?
  In-Reply-To: <fj3cum$2qg8$1@news.hub.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox