Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Tables Involved in Stored procedure Expand / Collapse
Author
Message
Posted Thursday, January 24, 2013 7:49 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Friday, July 18, 2014 2:05 PM
Points: 3,943, Visits: 2,957
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.



Tally Tables - Performance Personified
String Splitting with True Performance
Best practices on how to ask questions
Post #1411144
Posted Thursday, January 24, 2013 8:02 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Today @ 11:27 AM
Points: 15,500, Visits: 27,884
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 )
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.

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
The Scary DBA
Author of: SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1411157
Posted Thursday, January 24, 2013 8:09 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Today @ 11:27 AM
Points: 15,500, Visits: 27,884
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
The Scary DBA
Author of: SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1411159
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse