pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Moving database and schema to a new tablespace
3+ messages / 3 participants
[nested] [flat]

* Moving database and schema to a new tablespace
@ 2011-09-08 18:09  Richard Shaw <richard@aggress.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Richard Shaw @ 2011-09-08 18:09 UTC (permalink / raw)
  To: pgsql-admin


Hi,

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 ?

Thanks in advance

Richard


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Moving database and schema to a new tablespace
@ 2011-09-08 18:55  Guillaume Lelarge <guillaume@lelarge.info>
  parent: Richard Shaw <richard@aggress.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Guillaume Lelarge @ 2011-09-08 18:55 UTC (permalink / raw)
  To: Richard Shaw <richard@aggress.net>; +Cc: pgsql-admin

On Thu, 2011-09-08 at 19:09 +0100, Richard Shaw wrote:
> Hi,
> 
> 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.


-- 
Guillaume
  http://blog.guillaume.lelarge.info
  http://www.dalibo.com




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Moving database and schema to a new tablespace
@ 2011-09-08 19:12  Marc Mamin <M.Mamin@intershop.de>
  parent: Guillaume Lelarge <guillaume@lelarge.info>
  0 siblings, 0 replies; 3+ messages in thread

From: Marc Mamin @ 2011-09-08 19:12 UTC (permalink / raw)
  To: Guillaume Lelarge <guillaume@lelarge.info>; Richard Shaw <richard@aggress.net>; +Cc: 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

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2011-09-08 19:12 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-09-08 18:09 Moving database and schema to a new tablespace Richard Shaw <richard@aggress.net>
2011-09-08 18:55 ` Guillaume Lelarge <guillaume@lelarge.info>
2011-09-08 19:12   ` Marc Mamin <M.Mamin@intershop.de>

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