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

Re: Moving database and schema to a new tablespace

From: "Marc Mamin" <M(dot)Mamin(at)intershop(dot)de>
To: "Guillaume Lelarge" <guillaume(at)lelarge(dot)info>, "Richard Shaw" <richard(at)aggress(dot)net>
Cc: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Moving database and schema to a new tablespace
Date: 2011-09-08 19:12:09
Message-ID: C4DAC901169B624F933534A26ED7DF3103E9175F@JENMAIL01.ad.intershop.net (view raw or flat)
Thread:
Lists: pgsql-admin
>> I'm looking to move a database by using ALTER DATABASE $DB  SET TABLESPACE and i'd also like to move a schema over to the same new tablespace, googling around, it looks like there was a an ALTER SCHEMA $SCHEMA SET TABLESPACE command in the past, but apparently no longer.   I'm using Postgres 9, can anyone confirm if this is still possible, and if not, how I can move the schema over ?
>> 

>ALTER SCHEMA... SET TABLESPACE never existed in PostgreSQL.

>As you're using PostgreSQL 9, you can use the DO command to do something
>like this. You need to find every table in the schema, and launch ALTER
>TABLE... SET TABLESPACE to them. And then do the same with indexes.

Hello,

Maybe you are looking after this ?

http://archives.postgresql.org/pgsql-performance/2006-08/msg00369.php

otherwise here is a howto foe moving tables and indexes one by one:

http://blog.lodeblomme.be/2008/03/15/move-a-postgresql-database-to-a-different-tablespace/

HTH,

Marc Mamin

In response to

pgsql-admin by date

Next:From: Bernhard RohrerDate: 2011-09-08 19:31:16
Subject: pg_upgrade from 9.0 to 9.1
Previous:From: Guillaume LelargeDate: 2011-09-08 18:55:27
Subject: Re: Moving database and schema to a new tablespace

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