A customer I was doing some performance testing for wanted to know how many particular transactions where being processed at any one time. Within their DB they capture the start time and end time of the transaction. So, I thought I could give them an indication of concurrency if I could construct a SQL query to extract and process the data.
Here is a a example that I have constructed in a simple MySQL DB (rather than use their data). For this purpose a table called log containing start and end time.
Here is the code I wrote. Any optimisation to the SQL welcome. (I am but a performance tester interested in the data)
SELECT tL.StartTime, (select count(1) from test.Log where StartTime = tL.StartTime) FROM test.Log tL where StartTime > 0 group by StartTime order by 1
Here is the output from running the query. It should be noted that it presents the concurrency at the start time of a new transaction.


