对用户定义函数内的语句进行分析
我正在尝试使用 SQL Server Profiler (2005) 来跟踪一些应用程序性能问题。所进行的调用之一是对表值用户定义函数的调用。该函数包装了一个将多个表连接在一起的选择。
在 SQL Server Profiler 中,会记录对 UDF 的调用。但是,根本不记录 UDF 之下的选择。因此,我没有获得有关哪些表和信息的有用数据。指数受到打击。我想将此信息提供给数据库优化顾问以获得一些索引建议。
有没有什么方法(除了解开查询本身之外)在 Profiler 中记录 UDF 调用的表?
I'm trying to use SQL Server Profiler (2005) to track down some application performance problems. One of the calls being made is to a table-valued user-defined function. This function wraps a select that joins several tables together.
In SQL Server Profiler, the call to the UDF is logged. However, the select that underlies the UDF isn't being logged at all. Because of this, I'm not getting useful data on which tables & indexes are being hit. I'd like to feed this info into the Database Tuning Advisor for some indexing advice.
Is there any way (short of unwrapping the queries themselves) to log the tables called by UDFs in Profiler?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能:多语句 TVF 是一个黑匣子,你只能
通过“黑匣子”获取 CPU、读取、写入等。我的意思是它是另一个查询中完全封装且不透明的一系列语句,并且没有“流动”就像您通过存储过程逐行获取一样。
内联 TVF 像视图或宏一样扩展到主查询中并且可以被看到。
编辑:相关:表值函数我在哪里查询计划去哪了?
You can't: a multi-statement TVF is a black box and you can only get CPU, Read, Writes etc.
by "black box" I mean it's a fully encapsulated and opaque series of statements inside another query, and there is no "flow" like you'd get line by line through a stored proc.
An in-line TVF is expanded like a view or macro into the main query and can be seen.
Edit: related: Table Valued Function where did my query plan go?