Page 1 of 1

How to get a query execution & fetch time ?

Posted: Mon 03 May 2010 17:45
by Pete B
Hi
It would be very interesting to know how this is done 8)

I have tried using TMyConnection GetExecuteInfo() but have never returned more than an empty string :( . The logical place for calling this to me seemed to be in an AfterExecute event ... is that correct ? However I think GetExecuteInfo() is more likely to return info like RowsAffected if I can get it to work ... is that correct ?

I've also seen a post here which wraps a query.execute with GetTickCount() calls to measure execution time. Is this really the only way ?

Finally, I use dbForge for MySQL which is a fantastic piece of software, it returns comprehensive SQL execution information such as ...
tbl_customers: Query opened in 0.007s [0.006s exec, 0.001s fetch]
... how is this achieved please ? It would be excellent to return this level of execution info.

thanks and best regards

Pete B

Posted: Wed 05 May 2010 08:28
by Dimon
The result of the GetExecuteInfo method depends on MySQL server behaviour, and not on MyDAC. You can see the description of the result format at MySQL Reference Manual mysql_info.
To get additional execution information you should handle events, like: BeforeOpen, AfterExecute, BeforeFetch, AfterFetch.

Posted: Wed 05 May 2010 12:15
by Pete B
Thanks for the advice, it's appreciated. :D