Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Trace Group Simular Statemments Expand / Collapse
Author
Message
Posted Tuesday, May 7, 2013 2:49 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, April 4, 2014 9:51 AM
Points: 41, Visits: 125
Hey

I run serveral traces and have a problem analyzing data

I know that there is some scripts out there, as can give me this statement has ran for x times and took y time.
Only issue is that vaules may differ in statements so my select returns one pr row.

Anyone? Please?
Post #1450031
Posted Tuesday, May 7, 2013 5:56 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 10:43 AM
Points: 12,888, Visits: 31,836
i create a a view for every trace i create; it's just much easier to access.


from there, i can group the data however i need to, since it's just an object.

--SELECT * from sys.traces
declare @TraceIDToReview int
declare @path varchar(255)
declare @cmd varchar(max)
SET @TraceIDToReview = 1 --this is the trace you want to review!
SELECT @path = path from sys.traces WHERE id = @TraceIDToReview
SET @cmd = '
CREATE VIEW MyCustomTrace' + CONVERT(VARCHAR,@TraceIDToReview) + ' AS
SELECT
TE.name As EventClassDescrip,
v.subclass_name As EventSubClassDescrip,
T.*
FROM ::fn_trace_gettable(' + @path + ', default) T
LEFT OUTER JOIN sys.trace_events TE ON T.EventClass = TE.trace_event_id
LEFT OUTER JOIN sys.trace_subclass_values V
ON T.EventClass = V.trace_event_id AND T.EventSubClass = V.subclass_value'
PRINT(@cmd)
EXEC(@cmd)



Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1450086
Posted Monday, May 13, 2013 2:58 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, April 4, 2014 9:51 AM
Points: 41, Visits: 125
Yes, but this only allows me to group on class / type of statement.

I would like to group simular statements

select * from table1 where id = 1 order by id
select * from table1 where id = 4 order by id

is in my perspective same statement, I need some statement that can "mask" criteria..
I can take a substring and cut all from where, but I need to know coulmns are used, in order to validate indexes, and also if coulmns are not same, it might be an other action in application
Post #1452004
Posted Monday, May 13, 2013 7:56 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 10:43 AM
Points: 12,888, Visits: 31,836
SpiderDK (5/13/2013)
Yes, but this only allows me to group on class / type of statement.

I would like to group simular statements

select * from table1 where id = 1 order by id
select * from table1 where id = 4 order by id

is in my perspective same statement, I need some statement that can "mask" criteria..
I can take a substring and cut all from where, but I need to know coulmns are used, in order to validate indexes, and also if coulmns are not same, it might be an other action in application


i'm already thinking the trace is the wrong tool for for validating indexes. the WHERE statement tells you what columns are used to find the index,and any SELECT * is going to bring in the clustered index to get all columns anyway, i'd think.
nothing int he trace will tell you but not what index was used, or that is potentially missing.
instead of a trace, you really need to look at the dynamic management views instead.

it depends on what you are really trying to do;
Are you looking for poorly performing queries?


Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1452111
Posted Monday, May 13, 2013 8:33 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, April 4, 2014 9:51 AM
Points: 41, Visits: 125
I have a application, I want to know WHERE my users are waiting.

This will be done by a trace, and import to table..

There I want to run a statement showning with total duration, number of executions and avarage duration..

This will clearly show me WHERE time is spent
Post #1452137
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse