Solved

Index on field that is primary key

Posted on 2004-11-01
392 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
Question by:jasimon9
    9 Comments
     
    LVL 6

    Expert Comment

    by:robertjbarker
    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
    At least that is how a primary key is shown in MS SQL Server.
    0
     

    Author Comment

    by:jasimon9
    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
     
    LVL 6

    Accepted Solution

    by:
    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
    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
    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
    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
    yes, it is .
    0
     

    Author Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
    SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    875 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

    12 Experts available now in Live!

    Get 1:1 Help Now