sql profiler 显示 nhibernate 运行查询两次?
我一直在对我正在开发的应用程序进行一些性能分析。 该应用程序基于 Web (asp.net),在 MSSQL Server (2005) 上使用旧版本的 NHibernate (1.0)。
针对应用程序运行探查器似乎显示出一些奇怪的东西,因为我们似乎查询对象两次,一次作为直接查询,一次包装在 sp_executesql 中。 例如:
SELECT col1, col2 FROM TABLE exec sp_executesql N'SELECT col1, col2 FROM TABLE'
查看探查器中的统计信息,我可以看到它们是不同的事件(选择记录为事件 45 - SP:StmtCompleted,而对 sp_executesql 的调用记录为事件 10 - RPC:Completed)。
在此之前我没有太多地使用 NHibernate,但我无法想象这是正常行为。 我是否误读了配置文件跟踪(在这种情况下我应该如何解释上述内容),或者是否有充分的理由?
如果上述情况像我想象的那样糟糕,有没有办法关闭这种行为?
谢谢
I have been doing some performance analysis on an application I am working on. The application is web-based (asp.net) using an old version of NHibernate (1.0) on MSSQL Server (2005).
Running profiler against the application seems to show something a little odd, in that we seem to be querying objects twice, once as a direct query and once wrapped in sp_executesql. for example:
SELECT col1, col2 FROM TABLE exec sp_executesql N'SELECT col1, col2 FROM TABLE'
Looking at the stats within profiler I can see they are distinct events (the select is recorded as event 45 - SP:StmtCompleted whilst the call to sp_executesql is recorded as event 10 - RPC:Completed).
I have not worked with NHibernate too much before this, but I cannot imagine this is normal behavior. Am I either mis-reading the profile trace (in which case how should I interpret the above), or is there a good reason for this?
If the above is as bad as I think, is there a way to switch this behavior off?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的查询不会运行两次。 只是这两个事件因同一条语句而被触发。
your queries are not run twice. It's just that those 2 events are fired for the same statement.