<legend id='JLlHm'><style id='JLlHm'><dir id='JLlHm'><q id='JLlHm'></q></dir></style></legend>
  • <i id='JLlHm'><tr id='JLlHm'><dt id='JLlHm'><q id='JLlHm'><span id='JLlHm'><b id='JLlHm'><form id='JLlHm'><ins id='JLlHm'></ins><ul id='JLlHm'></ul><sub id='JLlHm'></sub></form><legend id='JLlHm'></legend><bdo id='JLlHm'><pre id='JLlHm'><center id='JLlHm'></center></pre></bdo></b><th id='JLlHm'></th></span></q></dt></tr></i><div id='JLlHm'><tfoot id='JLlHm'></tfoot><dl id='JLlHm'><fieldset id='JLlHm'></fieldset></dl></div>
    • <bdo id='JLlHm'></bdo><ul id='JLlHm'></ul>

    <tfoot id='JLlHm'></tfoot>

    <small id='JLlHm'></small><noframes id='JLlHm'>

        执行次数最多的存储过程?

        Most Executed Stored Procedure?(执行次数最多的存储过程?)
        <tfoot id='hkIVI'></tfoot>

        <small id='hkIVI'></small><noframes id='hkIVI'>

          <bdo id='hkIVI'></bdo><ul id='hkIVI'></ul>

          1. <legend id='hkIVI'><style id='hkIVI'><dir id='hkIVI'><q id='hkIVI'></q></dir></style></legend>
            <i id='hkIVI'><tr id='hkIVI'><dt id='hkIVI'><q id='hkIVI'><span id='hkIVI'><b id='hkIVI'><form id='hkIVI'><ins id='hkIVI'></ins><ul id='hkIVI'></ul><sub id='hkIVI'></sub></form><legend id='hkIVI'></legend><bdo id='hkIVI'><pre id='hkIVI'><center id='hkIVI'></center></pre></bdo></b><th id='hkIVI'></th></span></q></dt></tr></i><div id='hkIVI'><tfoot id='hkIVI'></tfoot><dl id='hkIVI'><fieldset id='hkIVI'></fieldset></dl></div>
                <tbody id='hkIVI'></tbody>

                • 本文介绍了执行次数最多的存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我们在应用程序中创建了这么多低效的存储过程,我们总是推迟以提高效率,直到我们的数据库性能出现严重问题.

                  We created so many inefficient stored procedure in our application, we always postpone to make it more efficient until we have serious problem with database performance.

                  现在,我想通过最常执行的存储过程来一个一个地修复它.

                  Now, I am thinking to fix it one by one order by most often executed stored procedure.

                  找出执行最多的存储过程的最佳方法是什么?

                  What is the best way to figure out which stored procedure is the most executed?

                  有没有脚本可以显示哪个存储过程执行得最多?

                  Is there a script that can show which stored procedure is the most executed?

                  推荐答案

                  使用:

                  SELECT TOP 10 
                         qt.TEXT AS 'SP Name',
                         SUBSTRING(qt.text, qs.statement_start_offset/2, CASE WHEN (qs.statement_end_offset = -1) THEN LEN(qt.text) ELSE (qs.statement_end_offset - qs.statement_start_offset)/2 END) AS actual_query,
                         qs.execution_count AS 'Execution Count',
                         qs.total_worker_time/qs.execution_count AS 'AvgWorkerTime',
                         qs.total_worker_time AS 'TotalWorkerTime',
                         qs.total_physical_reads AS 'PhysicalReads',
                         qs.creation_time 'CreationTime',
                         qs.execution_count/DATEDIFF(Second, qs.creation_time, GETDATE()) AS 'Calls/Second'
                    FROM sys.dm_exec_query_stats AS qs
                    CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS qt
                   WHERE qt.dbid = (SELECT dbid
                                      FROM sys.sysdatabases
                                     WHERE name = '[your database name]')
                  ORDER BY qs.total_physical_reads DESC
                  

                  参考:SQL SERVER – 2005 – 查找最高/最常用的存储过程

                  这篇关于执行次数最多的存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)(超出最大存储过程、函数、触发器或视图嵌套级别(限制 32))
                  How to View Oracle Stored Procedure using SQLPlus?(如何使用 SQLPlus 查看 Oracle 存储过程?)
                  How to debug stored procedure in VS 2015?(如何在 VS 2015 中调试存储过程?)
                  Set the variable result, from query(设置变量结果,来自查询)
                  What is dynamic SQL?(什么是动态 SQL?)
                  Mysql - How to quit/exit from stored procedure(Mysql - 如何退出/退出存储过程)

                  <i id='TSwhZ'><tr id='TSwhZ'><dt id='TSwhZ'><q id='TSwhZ'><span id='TSwhZ'><b id='TSwhZ'><form id='TSwhZ'><ins id='TSwhZ'></ins><ul id='TSwhZ'></ul><sub id='TSwhZ'></sub></form><legend id='TSwhZ'></legend><bdo id='TSwhZ'><pre id='TSwhZ'><center id='TSwhZ'></center></pre></bdo></b><th id='TSwhZ'></th></span></q></dt></tr></i><div id='TSwhZ'><tfoot id='TSwhZ'></tfoot><dl id='TSwhZ'><fieldset id='TSwhZ'></fieldset></dl></div>
                    <tbody id='TSwhZ'></tbody>

                        • <bdo id='TSwhZ'></bdo><ul id='TSwhZ'></ul>
                          <legend id='TSwhZ'><style id='TSwhZ'><dir id='TSwhZ'><q id='TSwhZ'></q></dir></style></legend>
                          <tfoot id='TSwhZ'></tfoot>

                            <small id='TSwhZ'></small><noframes id='TSwhZ'>