从 2005 年的 SQL Profiler 选择事件来分析查询
我需要分析一个大型 SQL 查询(在特定数据库中,而不是整个服务器),但我不知道如何设置分析器。我尝试阅读 MSDN SQL 网站,但没有帮助。
我被困在跟踪属性“事件选择”窗口。我需要有关在“事件选择”窗口中选择哪些项目的帮助。
我更感兴趣的是找出为什么查询没有填充表(而不是性能)
谢谢
I need to profile a large SQL query (in a particular database, not the whole server), and I cant figure out how to setup the profiler. I tried reading MSDN SQL web site, but it has not helped.
I am stuck at the Trace Properties "Events Selection" window. I need help as to which items to select in "Events Selection" window.
I am more interested in finding out why the query is not populating the tables (as opposed to performance)
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果通过大型 SQL 查询,您的意思是包含多个单独语句的大型存储过程,并且您希望在调用存储过程时分析每个语句 (像这样)然后监视 SP:StmtCompleted 事件。否则,只需选择“标准”配置文件模板就足够了。
在研究查询性能不佳时,我首先要做的事情之一就是查看执行计划 - 这会告诉您时间花在哪里。
If by large SQL query, you mean a large stored procedure that contains multiple individual statements and you want to profile each of those statements when the sproc is called (like this) then monitor the SP:StmtCompleted event. Otherwise, just choosing the "Standard" profile template should suffice.
One of my first ports of call when looking into poor performance of a query would be to look at the execution plan though - that will tell you where the time is being spent.
我通常使用以下设置。正如米奇所说,这取决于你想要什么。
在“常规”选项卡上选择
TSQL_Duration 来自“使用
模板:”下拉列表。
在事件选择选项卡上选择
RPC:如果您观看
,则已完成
存储过程或 SQL:BatchCompleted 如果
您只是在观看查询。
选中右侧的所有框。
您可以根据您使用的模板监控不同的事件。我还发现“调整”可以派上用场。
可能会出现大量其他内容,因此您可能需要通过编辑单击“列过滤器...”按钮时出现的一些信息来过滤显示的内容。
示例:
持续时间超过 3000(3 秒)
TextData 包含一些特定于您的查询的文本 (%stored_proc_name%)
I usually use the following setup. As Mich said it depends on what you want tho.
On the General tab select
TSQL_Duration from the "Use the
template:" drop down list.
On the events selection tab select
RPC:Completed if your watching a
stored proc or SQL:BatchCompleted if
you are just watching for queries.
Check all boxes to the right.
You can monitor different events based on the template you use. I have also found "Tuning" to come in handy.
There might be a TON of other stuff that comes up so you may want to filter what is displayed by editing some of the information that comes up when you click the "Column Filters..." button.
Examples:
Duration over 3000 (3 seconds)
TextData has some text that is specific to your query ( %stored_proc_name% )