I was thinking for building a consolidated Script to to identify performance bottlenecks, where I wanted to looks at following information :
- SQL and OS Version information for current instance
- Hardware information
- System Manufacturer and model number and processor description
- SQL Server configuration
- File Names and Paths for TempDB and all user databases
- Recovery model, log reuse wait description, log file size, log usage size and compatibility level
- Average stalls per read, per write, and per total input/output for each database file
- CPU utilization by database
- Buffer usage by database
- How much memory (in the buffer pool) is being used by each database
- Top waits for server instance
- Signal Waits information
- logins that are connected and how many sessions they have
- Average Task Counts
- Get CPU Utilization History for last 256 minutes
- Good basic information about memory amounts and state
- SQL Server Process Address space info
- Page Life Expectancy (PLE) value for default instance
- Memory Grants Pending value
- Memory Clerk Usage
- Find single-use, ad-hoc queries that are bloating the plan cache
- – Gives you the text and size of single-use ad-hoc queries that waste space in the plan cache
- – Enabling ‘optimize for ad hoc workloads’ for the instance can help (SQL Server 2008 and 2008 R2 only)
- – Enabling forced parameterization for the database can help, but test first!
- Individual File Sizes and space available for current database
- How large and how full the files are and where they are located
- Make sure the transaction log is not full!!
- I/O Statistics by file for the current database
- This helps you characterize your workload better from an I/O perspective
- Get VLF count for transaction log for the current database,
- Lower the Counter is better
- Top Cached SPs By Execution Count
- Tells you which cached stored procedures are called the most often
- Top Cached SPs By Avg Elapsed Time
- helps you find long-running cached stored procedures that may be easy to optimize with standard query tuning techniques
- Top Cached SPs By Total Worker time (SQL 2008). Worker time relates to CPU cost
- Top Cached SPs By Total Logical Reads (SQL 2008). Logical reads relate to memory pressure
- Find the most expensive cached stored procedures from a memory perspective
- Top Cached SPs By Total Physical Reads (SQL 2008). Physical reads relate to disk I/O pressure
- Find the most expensive cached stored procedures from a read I/O perspective
- Top Cached SPs By Total Logical Writes
- find the most expensive cached stored procedures from a write I/O perspective
- Lists the top statements by average input/output usage for the current database
- find the most expensive statements for I/O by SP
- Possible Bad NC Indexes (writes > reads)
- indexes with high numbers of writes and zero or very low numbers of reads
- Missing Indexes current database by Index Advantage
- Find missing index warnings for cached plans in the current database
- missing indexes to specific stored procedures
- Breaks down buffers used by current database by object (table, index) in the buffer cache
- what tables and indexes are using the most memory in the buffer cache
- Get Table names, row counts, and compression status for clustered index or heap
- When Statistics were last updated on all indexes?
- Get fragmentation info for all indexes above a certain size in the current database?
- Index Read/Write stats (all tables in current DB)
- Show which indexes in the current database are most active
I was amazed to see that a senior SQL Server Community member "Glenn Berry" has already posted a great script, which helps you to get all this information.
You can download this Script freely here . As per Mr. Glenn Berry, it’s recommend that you run each query separately, after you read the instructions and comments on how to interpret the results. The first half of the queries focus on your SQL Server instance, while the second half focuses on a specific SQL Server database on that instance.
SQL Server 2008 Diagnostic Information Queries.
Once you analyzing data which is being captured by above mentioned script, identify bottleneck and resolving that bottleneck.
Once that bottleneck is resolve, you CPU / Memory will say thank you to you !!!
