Optimisation of Queries using Access and the Jet EngineI recently read your advice on Carl & Gary's Visual Basic Home Page entitled Speeding up the Jet Engine, and found the tip on using tables and the "seek" command very useful. I have recently read vast amounts of advice about optimising queries and database access using ODBC and external databases, but not about optimisation of queries using the Access 2.0 and the Jet Engine.
I was wondering if you could shed any more light on this subject, or if you were aware of any sources which may be able to do so.
Thanks,
From: Craig Hann
Position: Computer Programmer
Organisation:The Personal Number Company PLC (England)
Email: 106216.2364@COMPUSERVE.COM
Optimising JET SQL and JET operations of all sorts is a hot topic, there are lots of sources of information. I guess the definitive source of information about using JET effectively is the 'JET Database Engine Programmer's Guide' - Microsoft Press.
This covers in depth how the JET engine actually works and suggests how you can work with it effectively.
You will also find a large number of references on the Microsoft knowledgebase, either check out MSDN or search the online knowledgebase at http://www.microsoft.com/kb/. You will probably find that many of the older articles are written from an Access perspective, but their suggestions apply wherever you are using JET. Remember to check that any article you are reading applies to the version of JET you are using.
Mercury Interactive sell a product called JET Inspector that is an excellent tool for looking under the covers at what JET is actually doing. It can log each call to JET, execution times and a handful of other information. This is great if you want to debug obscure problems or see which part of a complicated process is chewing up the execution time. This is cool and has saved me from extremely weird bugs a couple of times.
You will also find a number of articles concerning efficient use of JET, VB Tips and Tricks and other such things within the Australian Visual Developers Forum. Then, of course, there's Carl & Gary's.
What else can I say? To a large degree everything you have read about optimising SQL Server and ODBC transactions applies in some way to using JET. Essentially you want to minimise your communication with the database engine, the fewer calls the less time anything takes. Also, you always want to be moving as little data as is feasible. Essentially, JET is an SQL engine for the desktop. Techniques that are efficient for SQL engines in general are efficient for JET. The major difference is that the SQL engine is on the same machine as the client application, so instead of minimising the use of Network bandwidth you want to minimise the use of memory and disk reads or writes. If you always keep these things in mind when developing and you take some time to read up a little when you can you should find that you can improve your application's response time noticeably by just changing the way you do a few things. I hope this helps you out, be sure to check out some of the internet sites I've suggested, a quick browse can be quite fruitful.
Jet Inspector is available within Australia from GUI Computing. Enjoy.