sqlserver性能调优常用方法
时间:2021-07-01 10:21:17
帮助过:3人阅读
o.name,
SUM(p.reserved_page_count) as reserved_page_count,
SUM(p.used_page_count) as used_page_count,
SUM(
case
when(p.index_id<
2) then (p.in_row_data_page_count+
p.lob_used_page_count+
p.row_overflow_used_page_count)
else p.lob_used_page_count+
p.row_overflow_used_page_count
end
) as DataPages,
SUM(
case
when (p.index_id<
2) then row_count
else 0
end
) as rowCounts
from sys.dm_db_partition_stats p inner join sys.objects o
on p.object_id=
o.object_id
group by o.name
order by rowCounts desc
View Code
2.通过活动监视器查看性能消耗
通过磁盘IO,CPU占用时间,逻辑读写的次数来判断哪些语句消耗性能比较大
3.通过执行时间,磁盘IO和执行计划查看sql语句情况,包括编译执行时间,索引扫描查找,读写等等
查看sql语句的执行时间和表扫描,逻辑读写情况的语句:
SET STATISTICS TIME ON
SET STATISTICS IO ON
sqlserver性能调优常用方法
标签: