Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: Sunday, February 7, 2016 12:18 PM
Points: 44, Visits: 130
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 @ 8:46 AM
Points: 14,458, Visits: 37,977
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

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
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: Sunday, February 7, 2016 12:18 PM
Points: 44, Visits: 130
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 @ 8:46 AM
Points: 14,458, Visits: 37,977
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

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
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: Sunday, February 7, 2016 12:18 PM
Points: 44, Visits: 130
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