zoukankan      html  css  js  c++  java
  • 数据库语句性能统计语句

    可以用以下语句统计数据库的性能,需要注意的是必须用管理员的权限打开数据库才可以执行。

       declare @n int set @n=30   

           
        ;with maco as   
        (     
            select top (@n)  
                plan_handle,  
                sum(total_worker_time) as total_worker_time ,  
                sum(execution_count) as execution_count ,  
                count(1) as sql_count  
            from sys.dm_exec_query_stats group by plan_handle  
            order by sum(total_worker_time) desc  
        )  
        select  t.text ,  
                a.total_worker_time ,  
                a.execution_count ,  
                a.sql_count  
        from    maco a  
                cross apply sys.dm_exec_sql_text(plan_handle) t
  • 相关阅读:
    clip属性,截取你想要显示的图片
    select背景灰色
    [转]ShowModal() = mrOk
    【转】Delphi-Unit文件结构
    析构方法
    [转]Delphi 7连接MySql /MariaDB
    MySQL/Mariadb遇见的问题
    更换数据库
    FlameRobin
    FireBird初使用
  • 原文地址:https://www.cnblogs.com/roy-blog/p/5976343.html
Copyright © 2011-2022 走看看