Posted - 08/18/2011 : 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).