# Thread: How to measure the transaction speed?

1. Registered User
Join Date
Mar 2003
Posts
223

## Unanswered: How to measure the transaction speed?

Hi, everyone:

Does anyone have the idea how to measue the transaction log speed? Do I need a special tool?

Thanks.

ZYT

2. Resident Curmudgeon
Join Date
Feb 2004
Location
In front of the computer
Posts
15,579
It depends on how/why you are measuring transaction speed. If it is for publication, you probably need to have an independant lab do it (your own numbers would be meaningless). If you are just trying to get a yardstick on performance, you can probably just time some transactions and compute the average of them.

-PatP

3. Registered User
Join Date
Mar 2003
Posts
223
Hello, Pat:

Thanks a lot for the reply. Yes, I am working on the performance tuning. Could you offer the details for your idea.

ZYT

4. Resident Curmudgeon
Join Date
Feb 2004
Location
In front of the computer
Posts
15,579
This code is completely untested, it is just to give you an idea:
PHP Code:
``` DECLARE @i INT, @d1 DATETIME ,  @d2 DATETIME, @d3 DATETIME, @d4 DATETIME SELECT @i = 10000 SELECT @loop = @i, @d1 = GetDate() WHILE 0 < @loop    BEGIN       SELECT @loop = @loop - 1    END SELECT @d2 = GetDate() SELECT @loop = @i, @d3 = GetDate() WHILE 0 < @loop    BEGIN       EXECUTE sp_who       SELECT @loop = @loop - 1    END SELECT @d4 = GetDate() SELECT (DateDiff(ms, @d3, @d4) - DateDiff(ms, @d1, @d2)) / Cast(@i AS real)  ```
The first loop isolates the amount of time used by the loop itself, which should be relatively small. The second loop repeats the code you wish to benchmark. When you are done, you subtract the overhead from the test time and divide by the number of iterations to compute the average.

-PatP

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•