Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving Clustered Index on large table 1

Status
Not open for further replies.

gradley

Programmer
Feb 24, 2004
335
US
Hi,

I'm looking for the most efficient method for moving a clustered index from the primary key (single IDENTITY field) to an existing index containing Date, Store and Associate. The table currently has about 91 million rows and takes up about 12 Gig of disk space.

Here are my questions:

1. Should I copy the data out to a work table using an ORDEY BY of the (NEW) clustered index - then copy back with the new indexes?
2. Recreate the indexes over the existing data?
3. Export the data to disk files and import using BCP?

Not sure what the best practice is for this type of change (besides designing it correctly in the first place).

Any feekback would be greatly appreciated.

Windows 2000 Advanced Server
SQL Server 2000 Enterprise Edition

 
Your best bet will be to simply drop and recreate the indexes on the existing tables. This will give you the least fragmentation on the indexes. Be sure to set your fill factor correctly when creating the new indexes.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(My very old site)
 
Thanks mrdenny!

I will follow your recommendation.

Just a follow-up question on the fill factor. Because this transaction table has a single point of INSERTS and no UPDATES, If I continue inserting the records in the order of the clustered index (Date, Store, Associate), I shouldn't need much of a fill factor -- correct?
 
Correct, if you are inserting only then the fill factor on your clustered index can be low in this case.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(My very old site)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top