• CirquedeSQLeil (8/28/2009)


    meichner (8/28/2009)


    I am not really a DBA, but I have assumed the role because of cutbacks. I need to add an index to a few of my tables due to performance issues. I have a few questions that I would appreciate answers to.

    1. Can I add an index to a table while the table is being accessed by users?

    2. Is there any downside to adding an index to a table?

    3. Is there any downside to adding the index while the table is being accessed? In other words will there be locking issues or something else that I have to be aware of?

    4. Will I need to re test the application that reads and writes to the database after adding the index or will the addition of the new index be transparent to the users (with the exception of the reads being faster)?

    Thanks so much

    What Version of SQL?

    1. Depends - table and index. It would be best to do it during maintenance in many cases.

    3. There is downside to adding an index while the table is being accessed - locking may occur. Depending on the nature of the table and the index being created, you could render the app inaccessible during the index creation.

    2. Downside to adding the index will be seen in inserts and updates. But this needs to be weighed against how often the table is accessed just for selects/ reads.

    4. Depends - sometimes it may be transparent, sometimes it could require retesting the app.

    I am using sql server 2005. Does that make any difference to the answers you supplied?

    Thanks