Solved

clustered and nc index on same columns- is that harmless

Posted on 2013-01-30
2
272 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 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:
Scott Pletcher 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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

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…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

717 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