Solved

clustered and nc index on same columns- is that harmless

Posted on 2013-01-30
2
249 Views
Last Modified: 2013-02-18
it makes no sense, but the prev designer has a clus index and also nc index on the same set of columns on a table. but is this harmless or can it cause problems..

the reason i ask is that the index was corrupted in this table.. could it have been because of the above fact?

(there are duplicates that should have never gotten in )
0
Comment
Question by:25112
2 Comments
 
LVL 51

Assisted Solution

by:Mark Wills
Mark Wills earned 250 total points
ID: 38839094
Well, cant say that I have done that before, but yes, it is harmless.

It will always maintain the clustered index first, then the NC index gets updated (because the nc index will use the clustered index key to point to data).

Bigger problems is probably those dupes :)

Dont normally use a clustered index on dupe values - it will add a uniquifier and creates a bit more overheads.

Are there any queries or procedures or scripts currently using specific index hints ? If not, then time to tidy up.

While it might be harmless, I would definitely remove the NC index - assuming the clustered index serves a higher purpose.

Do you have a unique index on that table ? If so, would be inclined to use that as your clustered index and then add in the other NC indexes afterwards.
0
 
LVL 69

Accepted Solution

by:
ScottPletcher earned 250 total points
ID: 38844455
Using the same columns for two (or more) indexes won't cause any errors.  The index corruption was caused by something else.

This set up can even be legimitately useful in specific cases, primarily when no other n-c indexes exist on that table.
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now