Re: Move tables to tablespace - Mailing list pgsql-admin

From praveen
Subject Re: Move tables to tablespace
Date
Msg-id 01c001c9335f$06e991d0$274610ac@praveenkm
Whole thread Raw
In response to Move tables to tablespace  ("Campbell, Lance" <lance@illinois.edu>)
List pgsql-admin
Yes you can do this using following commands.
For tables:-
select ' alter table '||tablename||' set tablespace <new tablespace name>;' from pg_tables where schemaname='<mention schema name here>' and tableowner='< mention table owner here >';
 
For index :-
select ' alter index '||indexname||' set tablespace <new tablespace name>;' from pg_indexes where schemaname='<mention schema name here>';
 
execute above commands in sql prompt and copy the output of these command and paste again in sql prompt.
----- Original Message -----
Sent: Monday, October 20, 2008 7:40 PM
Subject: [ADMIN] Move tables to tablespace

I would like to have an SQL statement that would move all of the tables and indexes found within a particular schema to a particular tablespace.  Is there a way I can do this?

 

Thanks,

 

Lance Campbell

Project Manager/Software Architect

Web Services at Public Affairs

University of Illinois

217.333.0382

http://webservices.uiuc.edu

 

pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: Privileges on sequences
Next
From: Isabella Ghiurea
Date:
Subject: oid2name