Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 ClearTrace Support Forum
 Trace filters

Author  Topic 

DrRandy
Starting Member

3 Posts

Posted - 2011-08-18 : 14:46:00
Hi, I was trying to get a trace for just really big reads - 1 GB or realy big writes - 10 MB. It appeared that I was getting a lot in the trace when setting the @MinReads value to 131072 in admin_trace_start. Perhaps filters need to be in a different order? The OR stuff first on duration, reads, cpu, and writes following by AND stuff? If I specify both a MinRead and a MinWrite, I suppose I would want the value for the read even if there were no writes.

-- Duration Filter
IF @MinDuration IS NOT NULL
exec @RC = sp_trace_setfilter @TraceID, 13, 1, 4, @MinDuration

etc (other OR stuff)

exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Profiler' -- AND

exec sp_trace_setfilter @TraceID, 1, 0, 7, N'exec sp_reset_connection' -- AND

I suppose if I wanted Reads > 10000 or Writes > 1000

(fltr col 16) OR (fltr col 17) AND (fltr col 10) AND (fltr col 1)?

I have not used T-SQL to set filters before. The logical AND/OR rules are not obvious to me. I don't see how I would have separate OR or AND groups. For example (reads > 1000 OR writes > 100) AND (cpu > 1000 or duration > 2000).

DrRandy
Starting Member

3 Posts

Posted - 2011-08-18 : 15:15:15
While I'm at it, units?

IF @MinDuration IS NOT NULL
PRINT 'Duration Filter: ' + CAST(@MinDuration AS VARCHAR) + ' microseconds'

IF @MinCPU IS NOT NULL
PRINT 'CPU Filter: ' + CAST(@MinCPU AS VARCHAR) + ' milliseconds'

IF @MinReads IS NOT NULL
PRINT 'Reads Filter: ' + CAST(@MinReads AS VARCHAR) + ' pages'

IF @MinWrites IS NOT NULL
PRINT 'Writes Filter: ' + CAST(@MinWrites AS VARCHAR) + ' pages'
Go to Top of Page
   

- Advertisement -