May 2, 2002 at 9:12 pm
I am trying to determine the number of transactions per second I am getting on an insert script.
Any ideas ?
If I can capture the query length(in seconds) in a variable this becomes very easy to get the transactions per second. Any ideas here ?
May 2, 2002 at 11:05 pm
Wrote this to answer my own question.
Works quite well.
/* INSERT SCRIPT IN WHILE LOOP WITH TRANSACTIONS PER SECOND CALCULATION */
DECLARE @i int
DECLARE @begindate datetime
SET @begindate = GETDATE()
INSERT INTO begindate(begindate)
VALUES(@begindate)
SET @i = '1'
WHILE (@i < 50001)
BEGIN
INSERT INTO testtransaction
VALUES(@i,'10-30-2001',25.00)
SET @i = @i + 1
CONTINUE
END
DECLARE @total_transactions int
SET @total_transactions = (SELECT COUNT(*) FROM testtransaction)
DECLARE @transactions_per_sec INT
DECLARE @datediff1 INT
SET @datediff1 = (SELECT DATEDIFF(SECOND, begindate, GETDATE()) FROM begindate)
SET @transactions_per_sec = @total_transactions/@datediff1
SELECT @transactions_per_sec AS Transactions_Second, @total_transactions AS Total_Transactions, @datediff1 AS Total_Test_Seconds
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply