|
I have a table with non-clustered index e.g. Index1 on Column1, Column2 & Column3 Now i want to create a clustered index2 on column1. Index creation time point of view, does it make any difference if the column is being used by other index?
(comments are locked)
|
|
In direct answer to your question, no. But creating a clustered index will physically order the data on the disk, so will take more time than creating a non-clustered index. Matt, given that the 2nd index is created is there any difference between 1 - if the 1st index is on col2 with col1 and col3 included and 2 - if the 1st index is over all 3 columns? Just curious!
Feb 22 '10 at 12:37 PM
Fatherjack ♦♦
Not really, no. There would be a difference if you clustered on more columns because when converting from a heap to a clustered index the non-clustered index would change such that it would go from pointing to RIDs to storing the clustered index values (so more columns = more space = more work). But I can't see any reason that the time would differ based on what was present in the non-clustered index. I'm sure I'll learn that I'm wrong a couple of years down the line though!! :)
Feb 22 '10 at 12:44 PM
Matt Whitfield ♦♦
Matt, its a good answer and true, but I think simply saying the clustered index physically orders the data hides a lot of very important nuance. Itzik Ben Gan has an article with a lot of the details and nuances at http://www.sqlmag.com/Article/ArticleID/92886/sql_server_92886.html
Feb 22 '10 at 02:30 PM
TimothyAWiseman
(comments are locked)
|
|
Based on your first index; Column1, Column2, Column3, I'd consider the second index on Column1 to be redundent. Of cousre, there is always that "It Depends" when it comes to any development.
(comments are locked)
|

