January 24, 2013 at 4:24 am
A stored Procedure which use to execute in 10 minutes, now it takes 1 hour to execute :w00t:
the data inside the Tables are same, i mean the volume of data is same as previous..
please suggest how do i make this execute fast???
Please help me with any query which will tell me what needs to be done?
************************************
Every Dog has a Tail !!!!! :-D
January 24, 2013 at 4:30 am
check the execution plan, update all statistics rebuild all indexes
also check out the links in my signature on posting performance problems
January 24, 2013 at 4:46 am
Update statistics?
Hmm i have never done Update statistics on Database yet..
Please correct my belwo plan..
Sunday no one wotks on the Database
will perfom the below activity..
1) Full Backup - Using manitenencae plan
2) Transaction Log Backup - Using manitenencae plan
3) Truncate Logs (this grows up to GB every day :angry: )
4) Update Statistics & then Rebuild Indexes - Using manitenencae plan
Please suggest
************************************
Every Dog has a Tail !!!!! :-D
January 24, 2013 at 4:56 am
Also please tell me how do i set the execution plan for that Stored procedure so that i will suggest developer to look into the specific query which is slowing the entire execution.
************************************
Every Dog has a Tail !!!!! :-D
January 24, 2013 at 5:04 am
Truncating your log files, eeesh, you need to put some proper transaction log management in place, regular shrinking of files is not best practise.
http://www.sqlservercentral.com/stairway/73776/
Also get a copy of the accidental DBA guide and read through all of it, again link in my signature for that eBook - has a full section on transaction logs and other main issues faced.
Don't use maintenance plans, they are very static in what do and dont provide any flexability, instead look at Ola's scripts (Link in my signature) they will do all your maintenance needs, backups, index rebuilds, statistic updates etc.
As for getting the execution plan, again look in my signature on posting performance problems, it tells you how to get the plan.
January 24, 2013 at 5:17 am
Check the fragmentation of all indexes by using sys.dm_index_usage_physical_stats.
If the fragmentation is more than 35% --Rebuild all the indices.
Ask the users about any change of code..? If so, Check for missing indices by using sys.dm_missing_index_details.
or else, save the SP to .sql file and open DTA(Database Tuning Advisor) and load this .sql file under workload option select your database from the list which shows below and click on Start Analysis, If you got the recommendations more than 65% apply all the recommendations provided SQL Server.
Thanks,
January 24, 2013 at 5:27 am
Take what the missing index view and DTA say with a pinch of salt, just dont apply anything it says at think it will work.
Your best off running DTA against a full workload, not just a single query, as DTA may advise on things which can impact other processes.
Run on a dev system, test it, test anything else which uses the tables you have just changed, then do the same on a test system, let the business use it, if they sign it off, then you can go to production
January 24, 2013 at 5:42 am
I ran the DTA tool on testing server considering that SP & that DB,
I got some object names in Index Recommendation & Estimated improvement = 0%, partition Recommendation = NULL
Date1/24/2013
Time7:32:52 AM
Server182.16.14.151
Database(s) to tune[test_DB]
Workload fileC:\RND.sql
Maximum tuning time58 Minutes
Time taken for tuning1 Minute
Expected percentage improvement 0.00
Maximum space for recommendation (MB)16072
Space used currently (MB)6126
Space used by recommendation (MB)6126
Number of events in workload4
Number of events tuned4
Now next what to be done???
************************************
Every Dog has a Tail !!!!! :-D
January 24, 2013 at 5:51 am
One more time
Read the link in my signature on posting performance problems, also read the link on posting code and data.
Update all your statitics, rebuild your indexes, post the execution plan as a SQLPLAN file, post your DDL of the tables involved, post the DDL of all indexes on the objects, post the definition of the store proc.
January 24, 2013 at 6:01 am
runal_jagtap (1/24/2013)
Sunday no one wotks on the Databasewill perfom the below activity..
1) Full Backup - Using manitenencae plan
2) Transaction Log Backup - Using manitenencae plan
3) Truncate Logs (this grows up to GB every day :angry: )
4) Update Statistics & then Rebuild Indexes - Using manitenencae plan
Please suggest
I suggest you reconsider that set of operations.
Please read through this - Managing Transaction Logs[/url]
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 24, 2013 at 7:49 am
If nothing changed, then it wouldn't be taking 6 times as long to run. Therefore, something must have changed. It might not be the data in the tables, but there's probably something.
Start by looking at the procedure and examine the execution plans. They'll tell you where your problems lie.
Take the information from there and check your existing indexes. Create new ones where appropriate, but don't believe everything that SQL Server tells you is missing; make sure they make sense and that you don't create duplicates. Overindexing is a real danger you need to avoid.
If you need more information on execution plans, check out Grant Fritchey's book on them. It is very good.
For more information on indexing, this site has an excellent stairway on the topic: http://www.sqlservercentral.com/stairway/72399/
Tuning is both an art and a science. Many people in this world spend a lot of time doing it and there's a lot to consider. You'll probably come up with the phrase "it depends" a lot. There's also most likely more than one way to fix the problem, but first you have to identify the problem. Don't underestimate the value of trying different approaches on a test server and benchmarking to see your results.
January 24, 2013 at 8:02 am
runal_jagtap (1/24/2013)
Update statistics?Hmm i have never done Update statistics on Database yet..
Please correct my belwo plan..
Sunday no one wotks on the Database
will perfom the below activity..
1) Full Backup - Using manitenencae plan
2) Transaction Log Backup - Using manitenencae plan
3) Truncate Logs (this grows up to GB every day :angry: )
4) Update Statistics & then Rebuild Indexes - Using manitenencae plan
Please suggest
If your database is in FULL recovery and you're only running log backups once a week, you have another issue besides the query. See this blog post.[/url]
As to the query, it does sound like your statistics are stale. Rebuilding the index automatically does a full scan on the statistics for that index. So, be sure you don't update the statistics after a rebuild because that leads to problems.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
January 24, 2013 at 8:09 am
MasterDB (1/24/2013)
Check the fragmentation of all indexes by using sys.dm_index_usage_physical_stats.If the fragmentation is more than 35% --Rebuild all the indices.
Ask the users about any change of code..? If so, Check for missing indices by using sys.dm_missing_index_details.
or else, save the SP to .sql file and open DTA(Database Tuning Advisor) and load this .sql file under workload option select your database from the list which shows below and click on Start Analysis, If you got the recommendations more than 65% apply all the recommendations provided SQL Server.
Thanks,
But, only rebuild the indexes if they're more than a single extent in size, otherwise you get no benefit from the defrag at all.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply