It seems like there should be better tools out there for profiling 开发者_高级运维sql than SQL Server Profiler. It takes forever to set up a profile session. I'm looking for a tool which is more like VS profiler. Just choose a stored procedure, and run it with a set of parameters, and what I should get is a profiling graph showing how long each query, SP call and function call takes, and allow me to drill down to individual statements with the parameters which were passed in.
I've seen some for Oracle, but I haven't seen any good tools for SQL server.
There is nothing wrong with SQL Profiler. Admittedly, it has its idiosyncrasies, but is nonetheless a good tool. The point being, there is often less value in tuning a single stored procedure than there is tuning a query workload.
I do not share your experience that "It takes forever to set up a profile session".
In SQL Server 2008 onwards, there are also extended events, BUT, though powerful, they do not have a simple GUI as yet.
UPDATE: If you have already identified the Stored Proc in question, run in SSMS with the 'Actual Execution Plan' turned on: that will indicate why it takes time to run. You can also include "SET STATISTICS IO ON" to give you a breakdown of the read/writes performed.
For examining execution plans, try using the free SQL Sentry Plan Explorer
SQL Server Profiler is a great tool. The first few times you use it it can take a bit, but you start to learn the events and the desired output pretty quickly.
An alternative would be to use the system stored procs and functions. Write up a script utilizing them to give you the output you want and then save it and just alter the specific parameters each time. But again this is very similar to saving templates within Profiler.
You may want to try SQL Sentry Plan Explorer. This is the much more usable and comprehensive tool than SSMS for the profiling your queries via analysis of the execution plan. For additional information, see this answer.
It's worth mentioning that the tool is available in the free and Pro editions, though, I have found no limitations of the free edition for my needs.
精彩评论