|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Mapping sql statements to TransactionId in a profiler trace fileI've added the TransactionId column to the tracer file in SQL Profiler, but the column just have data when a transaction is starting or finishing. How do I map a TransactionId to a SQL statement? Is it something possible to do? My objective is to generate a performance report from a trace file. It would answer questions like "Which are the tables involved in the longest running transactions?" or "Which tables are involved in the rolled back transactions?". I'm using SQL Server 2000. kind regards, Paulo Eduardo Neves Paulo Eduardo Neves wrote:
> I've added the TransactionId column to the tracer file in SQL Determine which column(s) produce a sort order equal to the order> Profiler, but the column just have data when a transaction is starting > or finishing. > > How do I map a TransactionId to a SQL statement? Is it something > possible to do? in which events were written to the trace table, then simply query which rows come between the start or end of a transaction when sorting on those columns. To determine which transactions are the longest, which were rolled back, etc., do something like select t1.event_time, t2.event_time, t2.commit_or_rollback from the_table t1 join the_table t2 on t1.TransactionID = t2.TransactionID and t1.event_type = 'Start Transaction' and t2.event_type = 'End Transaction' (Actual column names and values are probably different; I'm just trying to illustrate concepts here.) On 28 set, 12:30, Ed Murphy <emurph***@socal.rr.com> wrote:
> Paulo Eduardo Neves wrote: I don't think it will work, since I have transactions running> > I've added the TransactionId column to the tracer file in SQL > > Profiler, but the column just have data when a transaction is starting > > or finishing. > > > How do I map a TransactionId to a SQL statement? Is it something > > possible to do? > > Determine which column(s) produce a sort order equal to the order > in which events were written to the trace table, then simply query > which rows come between the start or end of a transaction when > sorting on those columns. concurrently in the trace file. But I think I can do it in queries with the same SPID. Would this approach include in the transaction the executed triggers? regards, Paulo |
|||||||||||||||||||||||