Query execution time measurement
Posted: Thu 25 Jul 2019 00:37
I am using Delphi XE7 and IBDAC 7 and UniDac 8. I have recently started using the SQLMonitor function to try and analyse query performance and it has been a great help. It is working as far as it goes, but I would really like to get specific information on how long each query takes.
Currently I log the output of SQLMonitor to a text/log file, and I record the time of the entry in the log file. I can also work out the time between the last log entry and the current one, and record that as well. But that is not the same thing as working out the actual query time.
I had thought to do this at the UniQuery level. ie record an entry in the BeforeOpen and then AfterOpen events. While this would seem to work, it is not a global function it is not really that practical.
UniConnection has DefaultTransaction events (OnStart and OnCommit). You don't seem to be able to use these events, but in theory, could these be used to time things?
Currently I log the output of SQLMonitor to a text/log file, and I record the time of the entry in the log file. I can also work out the time between the last log entry and the current one, and record that as well. But that is not the same thing as working out the actual query time.
I had thought to do this at the UniQuery level. ie record an entry in the BeforeOpen and then AfterOpen events. While this would seem to work, it is not a global function it is not really that practical.
UniConnection has DefaultTransaction events (OnStart and OnCommit). You don't seem to be able to use these events, but in theory, could these be used to time things?