Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Index on field that is primary key

Posted on 2004-11-01
9
Medium Priority
?
396 Views
Last Modified: 2006-11-17
I have inherited a database. There is an index that I believe exists by mistake and want to know if there is any other possible reason it exists before dropping it.

The table has a primary key. In addition, it has an ascending index on that primary key. I see no reason that this key exists.

Is there any reason why I should not just drop it?
0
Comment
Question by:jasimon9
  • 4
  • 3
  • 2
9 Comments
 
LVL 6

Expert Comment

by:robertjbarker
ID: 12468620
A primary key is a clustered, unique, and by default asscending, index.
Are you sure the index you are looking at is not the primary key index?
0
 
LVL 6

Expert Comment

by:robertjbarker
ID: 12468672
At least that is how a primary key is shown in MS SQL Server.
0
 

Author Comment

by:jasimon9
ID: 12468943
I am using SQL server, as you direct your comment.

Yes, I am sure that in addition to the primary key (clustered, unique, ascending). The other index is on the same field and is ascending. Therefore it seems to serve no purpose and only to add overhead.

So I want to drop it.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Accepted Solution

by:
robertjbarker earned 400 total points
ID: 12469650
It would not seem reasonable to have an index that duplicates the primary key.

The only reason I could think of is that it is possible to direct a query to use a specific index. If someone has done that somewhere in a query or stored procedure, that code would break. To write such code might be unwise. That doesn't mean it hasn't been done.
0
 

Author Comment

by:jasimon9
ID: 12469706
I am very confident that there would be no such code. And if it broke it--we could quickly remedy it.

Based on your comment I am going to just go ahead and drop that index. And will award points. Will let you know if there is an adverse outcome--otherwise, you can assume everything went fine.
0
 
LVL 44

Assisted Solution

by:Arthur_Wood
Arthur_Wood earned 100 total points
ID: 12472007
there is no reason for a second index on the primary Key, but in turn, its existence does not affect anything, so why worry about it?

AW
0
 

Author Comment

by:jasimon9
ID: 12475736
I don't like leaving a mess around waiting for something to go wrong. I like to keep a "tidy" system.

Are you saying the overhead (space and update time) is negligible?

0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 12478395
yes, it is .
0
 

Author Comment

by:jasimon9
ID: 12549242
I am going out of town for a few days. Won't be able to evaluate the responses until new week.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

916 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