![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi How can I measure query performance. I can see in the DB tools section of Access there is an Analyse Perfromace which is useful. However I want to run Query1 see how long it takes then run Query2 and see how long it takes both queries produce the same columns and rows. But I THINK due to caching the second query is always going to benefit. Does anyone have simple tips. The only thing I can think of is to shut access down and restart after each test. How do others do this. Thanks |
#3
| |||
| |||
|
|
Try adding a module like below and running it several times: Option Compare Database Option Explicit Private Declare Function timeGetTime _ Lib "winmm.dll" () As Long Private mlngStartTime As Long Private Function ElapsedTime() As Long * * ElapsedTime = timeGetTime() - mlngStartTime End Function Private Sub StartTime() * * mlngStartTime = timeGetTime() End Sub Public Function MyTest() * * Call StartTime * * * * DoCmd.OpenQuery "Query1" * * * * DoCmd.GoToRecord acDataQuery, "Query1", acLast * * Debug.Print ElapsedTime() & _ * * *": Using Query1." * * Call StartTime * * * * DoCmd.OpenQuery "Query2" * * * * DoCmd.GoToRecord acDataQuery, "Query2", acLast * * Debug.Print ElapsedTime() & _ * * *": Using Query2." End Function -- Arvin Meyer, MCP, MVPhttp://www.datastrat.comhttp://www.accessmvp.comhttp://www.mvps.org/access Co-author: "Access Solutions", published by Wiley "Yitzak" <terrysha... (AT) yahoo (DOT) co.uk> wrote in message news:ddc80453-91a9-4cf7-91bf-6cd40ba3332e (AT) y31g2000prd (DOT) googlegroups.com... Hi How can I measure query performance. I can see in the DB tools section of Access there is an Analyse Perfromace which is useful. However I want to run *Query1 see how long it takes then run Query2 and see how long it takes both queries produce the same columns and rows. But I THINK due to caching the second query is always going to benefit. Does anyone have simple tips. The only thing I can think of is to shut access down and restart after each test. How do others do this. Thanks- Hide quoted text - - Show quoted text - |
#4
| |||
| |||
|
|
Just wanted to check my improvements are real and not a function of Access/Jet being clever 2nd time around. |
#5
| |||
| |||
|
|
Yitzak wrote: Just wanted to check my improvements are real and not a function of Access/Jet being clever 2nd time around. Be very careful before leaping to any conclusions. *If the two queries use the same table, all the data will probably be loaded into memory and the second time it's used, may be dramatically faster only because of Windows optimizations. The least you should do is restart windows between testing each query. *Even then, Windows may be working on a different set of others tasks so you should also get a statistical average across several test runs. -- Marsh |
#6
| |||
| |||
|
|
Yitzak wrote: Just wanted to check my improvements are real and not a function of Access/Jet being clever 2nd time around. Be very careful before leaping to any conclusions. If the two queries use the same table, all the data will probably be loaded into memory and the second time it's used, may be dramatically faster only because of Windows optimizations. The least you should do is restart windows between testing each query. Even then, Windows may be working on a different set of others tasks so you should also get a statistical average across several test runs. |
#7
| |||
| |||
|
|
Wouldn't throwing away the results from the first pair of tests, then running several more to develop an average minimize the effect of windows' caching of data? |
#8
| |||
| |||
|
#9
| |||
| |||
|
|
"Clif McIrvin" <clare.nom... (AT) gmail (DOT) com> wrote innews:iipaju$94m$1 (AT) news (DOT) eternal-september.org: Wouldn't throwing away the results from the first pair of tests, then running several more to develop an average minimize the effect of windows' caching of data? I'd think much more important would be Jet's caching, and you can control that by flushing the DBEngine cache between runs of the query. Sure, it's possible disk caching could have an effect as well, but what are you really testing? Jet or Windows? I'd say run the first one, throw it out (because of Windows disk caching), flush the Jet/ACE DBEngine cache and then run it again several times (flushing the Jet/ACE cache between each run). That would give you results for Jet that would probably keep most of Windows out of the picture. Slowdowns from page faults and swapping to disk and all that are just not something you can control for, so you'd want to run the tests with the minimal programs running. That might include turning off things like AV checking and the like, and any number of background tasks. But how precise a result do you really want? I'd think that running several instances of the test in the same operating environment would give you relative performance numbers, which are all that matters (i.e., how much faster is one query than a different one?). -- David W. Fenton * * * * * * * * *http://www.dfenton.com/ contact via website only * *http://www.dfenton.com/DFA/ |
#10
| |||
| |||
|
|
"Marshall Barton" wrote Yitzak wrote: Just wanted to check my improvements are real and not a function of Access/Jet being clever 2nd time around. Be very careful before leaping to any conclusions. If the two queries use the same table, all the data will probably be loaded into memory and the second time it's used, may be dramatically faster only because of Windows optimizations. The least you should do is restart windows between testing each query. Even then, Windows may be working on a different set of others tasks so you should also get a statistical average across several test runs. Wouldn't throwing away the results from the first pair of tests, then running several more to develop an average minimize the effect of windows' caching of data? |
![]() |
| Thread Tools | |
| Display Modes | |
| |