Performance analysis of SQL server disk I / O

IO is the most important resource sql server, after sqlserver database services start in a production environment for a week, it can be analyzed by dmv optimization. MS SQL Server provides a number of dynamic management views and functions for our analysis of disk I / O performance.

一.按照物理读的页面数排序 前50名
SELECT TOP 50
qs.total_physical_reads,qs.execution_count,
qs.total_physical_reads/qs.execution_count AS [avg I/O],
qs. creation_time,
qs.max_elapsed_time,
qs.min_elapsed_time,
SUBSTRING(qt.text,qs.statement_start_offset/2,
(CASE WHEN qs.statement_end_offset=-1
THEN LEN(CONVERT(NVARCHAR(max),qt.text))2
ELSE qs.statement_end_offset END -qs.statement_start_offset)/2) AS query_text,
qt.dbid,dbname=DB_NAME(qt.dbid),
qt.objectid,
qs.sql_handle,
qs.plan_handle
from sys.dm_exec_query_stats qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS qt
ORDER BY qs.total_physical_reads DESC
二.按照逻辑读的页面数排序 前50名
SELECT TOP 50
qs.total_logical_reads,
qs.execution_count,
qs.max_elapsed_time,
qs.min_elapsed_time,
qs.total_logical_www.078881.cn reads/qs.execution_count AS [AVG IO],
SUBSTRING(qt.text,qs.statement_start_offset/2,
(CASE WHEN qs.statement_end_www.qinlinyule.cn offset=-1
THEN LEN(CONVERT(NVARCHAR(max),qt.text)) www.mcyllpt.com
2
ELSE qs.statement_end_offset END www.leyou2.net -qs.statement_start_offset)/2)
AS query_text,
qt.dbid,
dbname=DB_NAME(qt.dbid),
qt.objectid,
qs.sql_handle,
creation_time,
qs.plan_handle
from sys.dm_exec_query_stats qs
APPLY sys.dm_exec_sql_www.fencaiyule.cn/ text the CROSS (qs.sql_handle) AS qt
the ORDER BY DESC qs.total_logical_reads
III. Analysis of the implementation plan for the statement, if the lack of prompt index (cause i / o scanning statistics more often), view the execution Clustered index scan program is found, this time by adding indexes into index lookup.
Four top article on best practices for storage of 10 (Storage Top 10 Best Practices) is required so on Microsoft's TechNet:
  1. understanding of requirements specification IO IO characteristics and applications of SQL Server.
  2. Use more / faster disk drive to get good performance
  3. Do not over-optimize storage, simple design can often provide good performance and flexibility.
  4. Verify the configuration prior to deployment. SQLIO test can simulate a tool.
  5. Always put the log files on RAID10 / RAID1.
  6. The isolated log files and data files from the physical disk.
  7. seriously consider data configuration of TempDB.
  8. CPU data files and the number of
the balance between capacity.
  9. Do not ignore the foundation of SQL Server.
  10. Do not overlook storage configuration

Guess you like

Origin blog.51cto.com/songlihuan/2481121