In this part we will see the use of DMVs in the following areas
1. TempDB uusage and Tuning Temp DB2. I/O usage and optimzation of I/O
1. TempDB usage in SQL Server
Apart from using temporary (#) and gloabl temporary (##) table , tempDB will be used in the following sceario
- When DBCC CHECKDB command is used
- using hash join, use of SORT_IN_TEMPDB option while creating index and use of CTEs
- Internal objects: work table (cursor, spool)
- Large object (LOB) variables
- Service Broker
- Temporary objects: global/local temp table, table vars
- Temporary objects in SPs and cursors
- Version store: General,MARS,online index,Triggers,snapshot isolation level
1. 1. How to tune tempDB
There is only one tempdb for a Server, and all user databases wiil be using it, hence tuning tempDB is necessary.- Store tempdb in sepearate fast SAN disk, which allows faster reads and write
- Create more than one tempDB file equivalent to number of CPUs (Number of Tempdb files = # CPUs), with equal size.
3. How to see tempDB usuage using DMV
The DMVB sys.dm_os_waiting_tasks can be queried against column wait_type like ‘PAGE%LATCH_%’ and resource_description like ‘2:%’ (for latches on TempDB pages, dbid = 2)
can be used to see tempdB usuage.
2 Monitoring I/O Performance
Major contributors of I/O activity are the following operations.
- Moving database pages between memory and disk
- Checkpoint operations, lazy writer, reads issued against database files, etc
- Transaction log file operations
- TempDB operations
2.1 DMV’s to monitor I/O
sys.dm_os_wait_stats where column wait_type like ‘PAGEIOLATCH%’, sys.dm_io_pendion_io_requestsTo find IO wating sys.dm_io_virtual_file_stats can be used
For Cumulative data related to IO performance / file level granularity sys.dm_exec_query_stats with *_reads, *_writes columns
We will see Performance counters to be used for SQL Server and threshold values in Part 3.
Happy reading...
No comments:
Post a Comment