So I have used SQL Profiler before and I know how I can view what my LINQ queries are doing behind the scenes. Now, we are in the process of identifying queries that may take more time and need to be optimized or have some indexing.
So, now when I view my LINQ queries in the profiler running it side by side there is lot of other data and queries that I dont care. Is there anyway the profiler or some other tools could sort the queries in the order of the largest time....so that I will work on optimizing it. I want to run my application and then see somehow in the profiler the worst queries of the lot.
Can anyone guide or direct me towards something that is more useful trying to do profiling with sql server 2005. Also any ideas or suggestions or best ways about going about profiling are welcome. Thanks.
SQL profiler is a GUI tool in Microsoft SQL Server relational database management system that allows us to monitor, analyze, troubleshoot, re-create, and trace the problems of SQL databases and their environments. It was first introduced in the SQL Server 2000 version.
SqlServer. Management. Trace namespace that contains the Microsoft SQL Server Trace and Replay objects will also be deprecated. Note that SQL Server Profiler for the Analysis Services workloads is not being deprecated, and will continue to be supported.
Yes, SQL Server Profiler does affect performance. When you trace using the GUI, all events are synchronously processed and filtered, so factors such as server load, network latency, which events you collect, and even where the collected events are stored, all contribute to overhead.
Here is a query on a DMV that will list queries with some details on CPU time. Once you pinpoint the query run it with Include Actual Execution Plan
set on to see the query flow and where you might need indexed.
select
highest_cpu_queries.plan_handle,
highest_cpu_queries.total_worker_time,
q.[text]
from
(select top 50
qs.plan_handle,
qs.total_worker_time
from
sys.dm_exec_query_stats qs
order by qs.total_worker_time desc) as highest_cpu_queries
cross apply sys.dm_exec_sql_text(plan_handle) as q
order by highest_cpu_queries.total_worker_time desc
Here is a good article on finding performance problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With