August 28, 2009 at 7:13 pm
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
August 28, 2009 at 10:05 pm
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.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
August 29, 2009 at 8:09 am
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
August 29, 2009 at 10:09 am
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
The same logic will apply for all versions of SQL Server. Personally, I'd not add the indexes to production while users are using the database.
Do you have access to a development or test server? It would be far better to test and analyze your index changes there - if you can look at the execution plans, IO stats and general resource usage before and after the new index, then you'll be able to deploy to the production environment safer in the knowledge that your new index is beneficial to the users.
Good luck!
August 29, 2009 at 11:52 am
Clive Strong (8/29/2009)
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
The same logic will apply for all versions of SQL Server. Personally, I'd not add the indexes to production while users are using the database.
Do you have access to a development or test server? It would be far better to test and analyze your index changes there - if you can look at the execution plans, IO stats and general resource usage before and after the new index, then you'll be able to deploy to the production environment safer in the knowledge that your new index is beneficial to the users.
Good luck!
Thanks so much for the advice. I do have a development environment. The problem is that I have a great deal of data in the production and very little in development. Due to ongoing development I can't restore the production data to development. I am going to have to come up with a way to restore the data from selected production tables to development. Once done I will follow your advice and add the indexes to my development database and test before creating the indexes in production. I will then have to add in the index when the application is not being used.
Thanks again
August 31, 2009 at 10:04 am
Clive Strong (8/29/2009)
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
The same logic will apply for all versions of SQL Server. Personally, I'd not add the indexes to production while users are using the database.
Do you have access to a development or test server? It would be far better to test and analyze your index changes there - if you can look at the execution plans, IO stats and general resource usage before and after the new index, then you'll be able to deploy to the production environment safer in the knowledge that your new index is beneficial to the users.
Good luck!
The same logic changes somewhat when going from SQL 2000 or 2005 standard to 2005 Enterprise, where one can use the online option. By using the online option, you may see less impact when creating the index.
http://msdn.microsoft.com/en-us/library/ms188783(SQL.90).aspx]
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 1, 2009 at 1:54 am
Very true...If only my company would let me get my hands on EE!!
As for moving data from certain tables from production to development, you can use SSIS/DTS, BCP, backup and restore (if you placed files in specific file groups) or direct copy (even a subset of data would help).
September 2, 2009 at 5:53 am
Clive Strong (9/1/2009)
Very true...If only my company would let me get my hands on EE!!As for moving data from certain tables from production to development, you can use SSIS/DTS, BCP, backup and restore (if you placed files in specific file groups) or direct copy (even a subset of data would help).
Thanks so much for the advice. I will attempt to learn how to use the options you suggested (SSIS/DTS, BCP). Can any of these be used on the live database?
Thanks
September 2, 2009 at 6:47 am
meichner (9/2/2009)
Clive Strong (9/1/2009)
Very true...If only my company would let me get my hands on EE!!As for moving data from certain tables from production to development, you can use SSIS/DTS, BCP, backup and restore (if you placed files in specific file groups) or direct copy (even a subset of data would help).
Thanks so much for the advice. I will attempt to learn how to use the options you suggested (SSIS/DTS, BCP). Can any of these be used on the live database?
Thanks
You can, yes...But it's better to do this offline.
September 3, 2009 at 6:46 am
Clive Strong (9/2/2009)
meichner (9/2/2009)
Clive Strong (9/1/2009)
Very true...If only my company would let me get my hands on EE!!As for moving data from certain tables from production to development, you can use SSIS/DTS, BCP, backup and restore (if you placed files in specific file groups) or direct copy (even a subset of data would help).
Thanks so much for the advice. I will attempt to learn how to use the options you suggested (SSIS/DTS, BCP). Can any of these be used on the live database?
Thanks
You can, yes...But it's better to do this offline.
Thanks so much for all the help.
September 4, 2009 at 6:52 am
Can you install another Dev Edition instance in DEV then restore the PROD db, or if you can't then how about restoring the database in dev as a different name?
Also you'll want to check your query plans to make sure they're using the new index/indices.
September 6, 2009 at 6:31 am
the biggest issue will occur during playing with clustered index
EE is quite nice, but an online option needs a properly setup tempdb (i.e. enough space)
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply