How do I measure the time taken for executing a Query in Access?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Could Anyone help me in finding as of How I can measure the time taken for
the execution of a Query.
Thank you.
 
Madhavan,
If you are calling the query from some language like VB, C, Delphi, etc,
before you call the query get the current time. When the query returns to
the app, get the current time again. The difference is the time the query
took relative to your app.
Pseudo code:
StartTime = Now
Execute query
EndTime = Now

HTH,
CF
 
Madhavan Kumar said:
Could Anyone help me in finding as of How I can measure the time taken for
the execution of a Query.


You can use an API call to get the system timer value:

Public Declare Function GetClock Lib "winmm.dll" _
Alias "timeGetTime" () As Long

For example:

pt = GetClock() ' Establish initial start time
run your query
Debug.Print GetClock() - pt

I'm not sure of the resolution of the clock's value, but I
think the units are milliseconds.

One point to keep in mind when doing this kind of
measurement is all the data caching that goes on in both
Windows and in Access. This means that the first time
(retrieve data from disk) you do something will take much
longer than subsequent times (retrieve it from a memory
cache). However, it may require you to restart your system
before you can be sure that there is no data being cached
when you think it's the first time you do it.
 
Back
Top