I have a SQL Server 2005 Enterprise Edition database table that has 768,526 rows in it with no primary key or clustered index. This database's logs are getting shipped to a disaster recovery server on an hourly basis. I need to create a clustered primary key constraint on this table; however when testing in my staging enviornment the log file gets full or I run out of disk space. What is the best approach for creating this index?
I have to believe the column(s) that will be target of your primary key has data that is unique. If that is the case can you live with creating a non-clustered unique index on the column(s) ? If one of the purposes of wanting to create a primary key in the first place is to ensure row uniqueness then you will have satisfied your condition. Even if your reason is to improve performance, you will have created an index that will be the basis for retrieving data rather than retrieving from the heap.
You may also want to check if your tempdb is constrained on max size. Index creation sometimes use tempdb.
Discuss This Question: 1  Reply