How to get a query execution & fetch time ?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Pete B
Posts: 15
Joined: Sat 13 Feb 2010 17:13
Location: NORWICH, UK

How to get a query execution & fetch time ?

Post by Pete B » Mon 03 May 2010 17:45

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

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 05 May 2010 08:28

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.

Pete B
Posts: 15
Joined: Sat 13 Feb 2010 17:13
Location: NORWICH, UK

Post by Pete B » Wed 05 May 2010 12:15

Thanks for the advice, it's appreciated. :D

Post Reply