question

ETHMAN5 avatar image
ETHMAN5 asked

How can i put Indexed tables on Seperate Disk

Hello All I want to keep all my indexed tables on seperate disk, can some one help me what are the steps to keep indexes on seperate drive.
indexes
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Håkan Winther avatar image Håkan Winther commented ·
I hope that you meant that the indexes for the tables should be kept on separate disk and not "indexed tables" on separate disks, because I hope every table have an index.
2 Likes 2 ·
Raj More avatar image Raj More commented ·
Do you want to keep Indexed Tables on a separate disk or just the indexes on a separate disk?
0 Likes 0 ·
ETHMAN5 avatar image ETHMAN5 commented ·
Yes.. not tables just indexes
0 Likes 0 ·
Magnus Ahlkvist avatar image
Magnus Ahlkvist answered
When you create the index, you can create it on a specific filegroup. First create a filegroup with files on the separate disk, then use CREATE INDEX with DROP_EXISTING clause to move them to the filegroup. Keep in mind that if you do this with the CLUSTERED index of a table, you will in fact move the actual table.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Tim avatar image Tim commented ·
+1, beat me by a couple of minutes. Next time I will just have to hang up my phone and type instead of multi tasking. :)
2 Likes 2 ·
Tim avatar image
Tim answered
You will want to create a new file group and have it on the separate drive. Then you will recreate your clustered index and specify it to be created on the File Group. The clustered index will move the table, non clustered will just put the index in the file group. CREATE CLUSTERED INDEX [idx_rowid] on [dbo].[My_table_name] ([rowid] ASC) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [YOUR_FILE_GROUP] The syntax above is the scripted out version of creating an index. Your values will differ. Just take note of the last line where the index is being created "ON my FileGroup"
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Raj More avatar image
Raj More answered
The steps to move the table are: 1. Create a FileGroup 2. use `ALTER TABLE` with the `MOVE TO` clause This will move the table (and I believe the clustered index). To move just the Index to a different filegroup, you will have to recreate it on the new file group
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Håkan Winther avatar image Håkan Winther commented ·
-1 The MOVE TO clause is specified in conjunction with DROP CONSTRAINT for the clustered index, and that is a bad idea. That will cause your table to become a heap on the specified filegroup.
2 Likes 2 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.