Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

How To Master a Database in SQL Server 2008 Expand / Collapse
Posted Tuesday, September 25, 2012 1:47 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, December 16, 2013 2:25 AM
Points: 2, Visits: 33
Hi All,
I am having few Databases in which i have to go through each and every table and stored procs etc.
I know if i have the statistics of DB it will be easy for me to go through tables and sps based on the priority of their execution .

Things I did
1. Found the frequency of each SP (hence i know which SP is frequently executed)
2. Found the no of Tables & SPS in each Database

My Doubt is
What are the other ways to get the statistics of Database in SQL Server 2008 so that i will be having an informed data hence i can learn more

Or How one can master all Databases in SQL Server (2008)

Post #1363836
Posted Tuesday, September 25, 2012 2:11 AM


Group: General Forum Members
Last Login: Saturday, January 26, 2013 2:59 AM
Points: 199, Visits: 240
The sys.dm_exec_query_stats is a central DMV to find the statistics of the current performance of cached query plans.
Post #1363847
Posted Tuesday, September 25, 2012 3:04 AM

SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 8:55 AM
Points: 8,593, Visits: 18,761
Familiarisation? Probably the easiest place to start is the Activity Monitor.
Watch for Recent Expensive Queries and examine them in detail as they come up. Experiment by sorting the columns - click on [Executions/mi] to see frequently-run queries. Hover on column titles to see which DMV is called to obtain the values.
Keep an eye on Waits in the Processes pane, and obtain more information if necessary from the relevant DMV.
Don't forget indexes. Glen Berry publishes a suite of diagnostic information queries on his website - they are tremendously useful for this type of investigation and include index investigation for refactoring.

“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #1363867
Posted Tuesday, September 25, 2012 4:30 AM



Group: General Forum Members
Last Login: Yesterday @ 12:17 PM
Points: 17,173, Visits: 32,139
If you're parachuting into a situation where there is no monitoring in place, then, as was already mentioned, use the Dynamic Management Objects (DMO) to query the cache in order to understand the most frequently called, most expense, longest running queries.

If you're living with a database over time, then setting up monitoring, preferably using a combination of Performance Monitor and Extended Events, to capture performance metrics about the system. This will lead you to understanding of the system in general.

I would ensure that you have maintenance routines in place to take care of statistics and possibly defragment indexes. While we're on indexes, most tables in most databases absolutely should have a clustered index. Where to place it is a design issue you won't be able to address directly since you're not designing the system, but I'd be concerned about any tables missing indexes.

From there, it's a slog. There are no shortcuts. See a query running long? Get the execution plan and see if modifying the structure or the T-SQL can help improve performance.

For lots more detail, get a copy of my book.

"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 Query Performance Tuning
SQL Server Execution Plans

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

Add to briefcase

Permissions Expand / Collapse