I am setting up a SQL Profiler and I wanted to have it filter on any items that have a duration > 30000 OR CPU > 10000 OR Writes > 1000
It seems like if I put those into the "column filter" area that it is an AND (i.e. I only get items when the duration, cpu and writes are over those limits).
Is there a way to have those be OR so that I get any items that fit any one of those criteria? I know I could start up three different profilers, each with the specific criteria, but it would be nice to have that all in one window/output.
I am currently on SQL 2008 R2, but hoping there is a general answer to this item.
Best Answer
You can't. SQL Server Profiler is a bit restricted in the way it displays and filters data.
Solution
You would be better off storing the traced data into a separate table on the same server and then querying the data at given intervals. The big benefit being you have the data in the table and can perform any complex
SELECT
statement you wish. Ensure you don't capture too much data by specifying one or two filter criteria.You could also consider running the SQL Server Profiler from the command prompt which will reduce the overhead of displaying the data constantly in an interface.
The parameters are:
Reference: Profiler (Microsoft Docs)
Steps
Alternatives
Seeing as you might be looking at a migration in the near future and because SQL Server Profiler is going out of fashion as mentioned by Microsoft, you could consider bringing your skills up-to-date by looking at Extended Events.
Reference: SQL Server Profiler (Microsoft Docs)
Extended Events
Extended Events is a light weight performance monitoring system that uses very few performance resources. Albeit with the slight drawback that there was no GUI for SQL Server 2008 (ok, there is an add-on for SSMS, which can be found on codeplex.)
An introduction into Extended Events can be found on Microsoft's site.