Home All Groups Group Topic Archive Search About
Author
29 Jul 2005 10:37 PM
Larry
We are on SQL Server 2000.
I have a huge stored procedure (2000 lines) written by someone who has
left, and we need to optimize it.
This stored procedure uses Global Temporary Tables.

Occasionally we get a timeout error, when this stored procedure is
executing.
We put in Lumigent’s Log explorer and found out we are getting deadlocks
multiple times as day.

I have run the trace and looked at it when the stored procedure in
question is run.

Is the duration in Milliseconds?

When I subtract the Start Time of a SP:StmtCompleted from the
Start Time of the corresponding SP:StmtStarting, it is not the same as the
Duration,

Why?
How can I use this information from the trace, to determine where the
lock is happening?

Thanks in Advance,

Laurence Nuttall
Programmer Analyst III
UCLA - Division of Continuing Education

Author
29 Jul 2005 10:43 PM
sze
You can capture lock events in SQL profiler. Under events selection
when you're setting up a trace, select the Lock:Deadlock and
Lock:Deadlock Chain events

Duration is indeed in ms.

Hope that helps!
Author
29 Jul 2005 11:01 PM
David Gugick
Larry wrote:
Show quote
> We are on SQL Server 2000.
> I have a huge stored procedure (2000 lines) written by someone who has
> left, and we need to optimize it.
> This stored procedure uses Global Temporary Tables.
>
> Occasionally we get a timeout error, when this stored procedure is
> executing.
> We put in Lumigent’s Log explorer and found out we are getting
> deadlocks multiple times as day.
>
> I have run the trace and looked at it when the stored procedure in
> question is run.
>
> Is the duration in Milliseconds?
>
> When I subtract the Start Time of a SP:StmtCompleted from the
> Start Time of the corresponding SP:StmtStarting, it is not the same
> as the Duration,
>
> Why?
> How can I use this information from the trace, to determine where the
> lock is happening?
>
> Thanks in Advance,
>
> Laurence Nuttall
> Programmer Analyst III
> UCLA - Division of Continuing Education

The duration is only accurate to about 15ms. If you want to use a high
resolution timer (in development) you can download one from
http://sqldev.net/.

--
David Gugick
Quest Software
www.imceda.com
www.quest.com

AddThis Social Bookmark Button