?
Solved

clustered and nc index on same columns- is that harmless

Posted on 2013-01-30
2
Medium Priority
?
275 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 51

Assisted Solution

by:Mark Wills
Mark Wills earned 1000 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:
Scott Pletcher earned 1000 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Suggested Courses

762 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