Page 1 of 1

Indexes On a Separate Drive Please

PostPosted: Wed Mar 17, 2010 12:22 pm
by bears
Hello,

Can you help me to I put just the indexes on a Separate Drive?

Thank You

Re: Indexes On a Separate Drive Please

PostPosted: Wed Mar 17, 2010 12:43 pm
by WhiteRider
What exactly do you mean?
PT3 doesn't directly control where your databases are - that is done by the postgres service.
There are some links to posts about this kind of thing in the Database / PostgreSQL FAQ.

Re: Indexes On a Separate Drive Please

PostPosted: Wed Mar 17, 2010 12:48 pm
by bears
Let's say I have my postgresql on drive A and I put my X_LOG files on drive B and my database files on drive C and now I want the index files on drive D.

I know how to accomplish the first 3 things. I don't know how to put the indexes on drive D.

Re: Indexes On a Separate Drive Please

PostPosted: Wed Mar 17, 2010 3:30 pm
by WhiteRider
I'm afraid I don't know enough about postgres to help you - Kraada will probably be able to help but he's off today.

Re: Indexes On a Separate Drive Please

PostPosted: Wed Mar 17, 2010 4:35 pm
by bears
Thank You WhiteRider.

Re: Indexes On a Separate Drive Please

PostPosted: Thu Mar 18, 2010 9:04 am
by kraada
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.