SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Trace Group Simular Statemments


Trace Group Simular Statemments

Author
Message
SpiderDK
SpiderDK
Valued Member
Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)

Group: General Forum Members
Points: 63 Visits: 131
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?
Lowell
Lowell
SSC Guru
SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)

Group: General Forum Members
Points: 67701 Visits: 40894
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!
SpiderDK
SpiderDK
Valued Member
Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)

Group: General Forum Members
Points: 63 Visits: 131
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
Lowell
Lowell
SSC Guru
SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)

Group: General Forum Members
Points: 67701 Visits: 40894
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!
SpiderDK
SpiderDK
Valued Member
Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)

Group: General Forum Members
Points: 63 Visits: 131
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search