pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: praveen <praveen.k@renaissance-it.com>
To: Campbell, Lance <lance@illinois.edu>
To: pgsql-admin@postgresql.org
Subject: Re: Move tables to tablespace
Date: Tue, 21 Oct 2008 14:55:58 +0530
Message-ID: <01c001c9335f$06e991d0$274610ac@praveenkm> (raw)
References: <B10E6810AC2A2F4EA7550D072CDE876001D209A6@SAB-FENWICK.sab.uiuc.edu>

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 ----- 
  From: Campbell, Lance 
  To: pgsql-admin@postgresql.org 
  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

   

view thread (3+ messages)

Message-ID: <01c001c9335f$06e991d0$274610ac@praveenkm>
Permalink:  ../01c001c9335f$06e991d0$274610ac@praveenkm/
Also on:    postgresql.org/message-id/01c001c9335f$06e991d0$274610ac@praveenkm

 · 

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: praveen.k@renaissance-it.com, lance@illinois.edu
  Subject: Re: Move tables to tablespace
  In-Reply-To: <01c001c9335f$06e991d0$274610ac@praveenkm>

* 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