Hi,
is there a way to get the time it took to execute a query (TMyQuery.Execute) ?
Thanks:)
TMyQuery: get execute time?
Re: TMyQuery: get execute time?
You can use the event handlers TMyQuery.BeforeExecute and TMyQuery.AfterExecute to calculate the time of the TMyQuery.Execute method execution.
If you want to know the query execution time on the server, you can use the following code:
If you want to know the query execution time on the server, you can use the following code:
Code: Select all
var
Time : Double;
...
MyQuery.SQL.Text := 'SET PROFILING = 1;' +
'INSERT INTO DEPT (DNAME) VALUES (''Test'');' +
'SHOW PROFILES;';
MyQuery.Execute;
Time := MyQuery.FieldByName('Duration').AsFloat;
ShowMessage(Format('Took execute query on server: %f sec', [Time]));