Indexes On a Separate Drive Please

PostgreSQL is the database server used to store information. Do you have a question or are you having problem with PostgreSQL? If so, post them here.

Moderator: Moderators

Indexes On a Separate Drive Please

Postby bears » Wed Mar 17, 2010 12:22 pm

Hello,

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

Thank You
bears
 
Posts: 28
Joined: Fri Jul 04, 2008 2:57 am

Re: Indexes On a Separate Drive Please

Postby WhiteRider » Wed Mar 17, 2010 12:43 pm

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.
WhiteRider
Moderator
 
Posts: 54018
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Indexes On a Separate Drive Please

Postby bears » Wed Mar 17, 2010 12:48 pm

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.
bears
 
Posts: 28
Joined: Fri Jul 04, 2008 2:57 am

Re: Indexes On a Separate Drive Please

Postby WhiteRider » Wed Mar 17, 2010 3:30 pm

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.
WhiteRider
Moderator
 
Posts: 54018
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Indexes On a Separate Drive Please

Postby bears » Wed Mar 17, 2010 4:35 pm

Thank You WhiteRider.
bears
 
Posts: 28
Joined: Fri Jul 04, 2008 2:57 am

Re: Indexes On a Separate Drive Please

Postby 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.
kraada
Moderator
 
Posts: 54431
Joined: Wed Mar 05, 2008 2:32 am
Location: NY


Return to PostgreSQL [Read Only]

Who is online

Users browsing this forum: No registered users and 34 guests

cron
highfalutin