M
Marshall Barton
Banana said:I don't doubt there will be many variables that could skew the tests
which was why I wanted to cross reference David's test to check what I
could have had missed.
FWIW- using OLE automation to start up an Access application and run
only one query using CurrentDb.Execute (e.g. no saved query), then
immediately closing, quitting and cleaning up does not appear to
materially affect the time. The Showplan seems to suggest that a new
instance of engine was started up via OLE Automation, so this should
reflect the boot time/cold start/no caching, I'd think.
I would not make that assumption because I have no idea how
vaeious versions of Windows handle its cache when a file
closed. I have seen many/most chacing schemes that kept the
file in cache until the space was needed and then chose the
least recently used to abandon. Some schemes even go so far
as to keep usage statistics and will drop the file with the
lowest usage stats regardless of its age.
I'm not so sure about multi-cores/CPU processing. AFAIK, Access
continues to be single-threaded so it'd always use one core so the
benefit of mulitple cores/CPU would be indirect in that OS may be able
to allocate competing resources to other cores/CPUs but beyond that, not
much difference. Note that while JET/ACE has a setting for numbers of
threads, KB articles suggests that thread safety was achieved only if
you use DAO or OLEDB provider and even so, thread-safety is limited.
I was thinking more in terms of the OS and other processes
competing for CPU cycles.
I also tried tweaking the threads setting from 1 to 4 (default is 3) and
the timing was not affected at least slightest, suggesting to me that
threading was not relevant here.
KB Article:
http://support.microsoft.com/kb/169395
http://support.microsoft.com/kb/299973
I looks to me that these articles are referring to using Jet
outside Access so I don't see their relevance to our
discussion.
As for processor & memory enabling a table scan to be as fast as index
scan, this was reason why I did extra check of doing a For...Next Loop
to get a rough idea of how much time it would take to do the false
comparisons that many time. If table scan actually were being done, the
time should have had increased when I expanded the tables. It didn't
while the For...Next loop increased just as much as the increase of
records. As a further comparison, doing a "Not PK = PK" was ridiculously
slow, around 40,000 milliseconds. It's also unfair because of comparing
two variables rather than two hard coded values, but I think the point
remains- if 1=0 actually did do a table scan, it should have been just
as slow as the For...Next loop at least and certainly four times slower
after the table expanded fourfold.
"Not PK = PK was ridiculously slow" is very telling, if your
test environment was nearly the same in both cases. The
drastic difference seems to clearly imply that a "real"
table scan is defierent from the WHERE False case so maybe
the oprimizer (in Access/Jet version ??) is now using the
information to skip the table scan. While Not PK = PK is
not as trivial as False or 1=0, it is still something that
can be reduced to False, so it does appear that WHERE False
has been dealt with in some version post A97. This is very
good to know and I think I can forget about posting comments
like the one that started this subthread.
I suppose I could try the test again by re-allocating only 512 MB to the
VM and see what happens.
If your test table were wide as well as tall, that might(?)
provide useful information, but with 2 GB ram, it may not.
Well, I've kind of found Showplan to be quite lacking in the details.
For instance, it still does not support showing plans when subqueries
are used, despite having had went through 2 more JET versions and 2 ACE
versions. Another telltale sign is that when the ShowPlan starts up, it
records the Date of 0, suggesting to me that any bugs, issues and/or
enhancements associated with ShowPlan wasn't considered high-priority
and for those reasons, I think it is prudent to take the Showplan's
output with a grain of salt.
That strikes me as odd. I thought Showplan was originally a
debugging tool used by the query optimizer developers.
Either they have a different tool now or they are very
confident of their ability to make code changes ;-)