SQL Server Profiler:如何更详细地检查/了解审核注销事件的持续时间? [英] SQL Server Profiler: How to inspect/understand the duration for the Audit Logout event in more detail?

查看:59
本文介绍了SQL Server Profiler:如何更详细地检查/了解审核注销事件的持续时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SQL Server Profiler 为我使用 Visual Studio 和 IIS Express 开发的 C# 应用程序分析一些 MS SQL 查询:

I am profiling some MS SQL queries with the SQL Server Profiler for my C# Application that I develop with Visual Studio and IIS Express:

为审核注销"事件指定的持续时间(16876 毫秒)是登录和注销之间的总时间.查询的持续时间仅为 60 毫秒.

The duration that is given for the event "Audit Logout" (16876 ms) is the total time between login and logout. The duration for the query is only 60 ms.

登录/注销事件与设置/拆除相关.

Login/Logout events are related to the setting up / tearing down.

来自什么是审核注销"在 SQL Server Profiler 中?

我想更详细地了解 16816 ms (= 16876 ms - 60ms) 的时间差.

a) 是否可以记录更多事件(例如调试模式")?

a) Is it possible to log more events (like a "debug mode")?

b) 因为Audit Login"事件的结束时间与查询执行的开始时间相同,所以假设时间差只是由于拆除造成的,是否正确?

b) Is it right to assume that the time difference is only due to tearing down because the end time of the "Audit Login" event is the same as the start time of the query execution?

c) 是否有其他工具可以分析(设置和)拆除时间?

c) Is there some other tool for analyzing (setup and) tear down times?

d) 时差是否取决于我的查询?换句话说:查询的优化是否也有助于减少时间差?

d) Does the time difference depend on my query? With other words: would an optimization of the query also help to reduce that time difference?

到目前为止我对@DevTime 的观察是,如果我第一次启动我的应用程序会有所不同(IIS Express 由 Visual Studio 启动,数据库是使用实体框架创建的,示例数据写入数据库) 或者如果我在数据库已经存在的情况下第二次启动它.

What I observed so far for @DevTime is that it makes a difference if I start my application the first time (IIS Express is started by Visual Studio, the database is created using the entity framework, example data is written to the database) or if I start it the second time when the database already exists.

第一次启动后登录的时间差比第二次启动后登录的时间差大约 15 秒.上例中标记的查询在用户登录后执行.因此,我希望当时数据库的初始化已经完成,并且初始化不会对时差产生任何影响.尽管如此,它似乎有影响.

For a login after the first start the time difference is about 15 s larger than for a login after the second start. The query that is marked in the example above is executed after user login. Therefore I would expect that the initialization of the database already has been finished at that time and that the initialization would not have any effect on the time difference. Nevertheless it seems to have an influence.

一些相关文章:

修复 IIS 初始加载缓慢

SQL Server 审核注销会产生大量阅读

https://docs.microsoft.com/de-de/sql/relational-databases/event-classes/audit-logout-event-class

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/84ecfe9e-ff0e-4fc5-962b-cffdcbc619ee/audit-logout-event-seems-slow-on-occasion?forum=sqldatabaseengine

推荐答案

当启动 SQL Profiler 时,会显示一个窗口 Trace Properties.第二个标签事件选择是可以选择考虑的事件的地方.

When starting the SQL Profiler a window Trace Properties is shown. The second tab Events Selection is the place where the considered events can be selected.

激活选项显示所有事件.

例如启用性能"部分下的Showplan XML FOR Query Compile"选项以记录更多事件.

Enable for example the option "Showplan XML FOR Query Compile" under the section "Performance" to log more events.

另请参阅如何确定 SQL Server 中正在编译的内容

这篇关于SQL Server Profiler:如何更详细地检查/了解审核注销事件的持续时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆