Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reducing the overhead of a SQL Trace with filters

We have a SQL 2000 server that has widely varied jobs that run at different times of day, or even different days of the month. Normally, we only use the SQL profiler to run traces for very short periods of time for performance troubleshooting, but in this case, that really wouldn't give me a good overall picture of the kinds of queries that are run against the database over the course of a day or week or month.

How can I minimize the performance overhead of a long-running SQL trace? I already know to:

  • Execute the trace server-side (sp_ create_trace), instead of using the SQL Profiler UI.
  • Trace to a file, and not to a database table (which would add extra overhead to the DB server).

My question really is about filters. If I add a filter to only log queries that run more than a certain duration or reads, it still has to examine all activity on the server to decide if it needs to log it, right? So even with that filter, is the trace going to create an unacceptable level of overhead for a server that is already on the edge of unacceptable performance?

like image 207
BradC Avatar asked Nov 13 '08 15:11

BradC


People also ask

How do you stop a trace in SQL Profiler?

To stop a trace Select a trace that is running. On the File menu, click Stop Trace.

What tools can be used to capture a trace of SQL Server and to monitor and record what is happening in relation to SQL?

Use SQL Server Profiler Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring an instance of the Database Engine or Analysis Services. You can capture and save data about each event to a file or table to analyze later.


1 Answers

Adding Filters does minimize the overhead of event collection and also prevents the server from logging transaction entries you don't need.

As for whether the trace is going to create an unacceptable level of overhead, you'll just have to test it out and stop it if there are additional complaints. Taking the hints of the DB Tuning Advisor with that production trace file could improve performance for everyone tomorrow though.

like image 128
Gordon Bell Avatar answered Oct 15 '22 22:10

Gordon Bell