by kraada » Thu Mar 18, 2010 9:04 am
In order to do this you'd want to create a tablespace on your spare disk.
Click Start --> Programs --> PostgreSQL --> psql to template1. This will open up a console window. In the console type:
CREATE TABLESPACE spare_disk LOCATION 'D:\\pg_data';
(This assumes that D: is your spare disk, and there's a new empty folder called pg_data - if your spare drive is E:, replace that as needed, and you can use a different folder if you'd like but it must be otherwise empty.)
Once the tablespace has been created, we can start moving your indices there. First, connect to your PT3 database: type \l and hit enter to list the databases, then \connect and your database name (in quotes if it contains any spaces) and hit enter and the prompt will change to indicate you've connected to that database.
For each index you want to move you then use this command:
ALTER INDEX name SET TABLESPACE spare_disk;
Where name is replaced with any index you want to move. You'll need to do this for each index that you want to move. For a complete list of indices in our database, once you're connected to our database type \di and hit enter.