Article ID: 208858 - Last Review: March 29, 2007 - Revision: 3.3 ACC2000: Optimizing for Client/Server PerformanceThis article was previously published under Q208858 Advanced: Requires expert coding, interoperability, and multiuser
skills. This article applies only to a Microsoft Access database (.mdb). On This PageSUMMARY This article lists tips to optimize the performance of Open
Database Connectivity (ODBC) data sources in Microsoft Access. NOTE: This article assumes that you are familiar with client/server environments and architectures. MORE INFORMATIONMethods of Accessing DataTo access server data with a client/server application, you can use one or more of the following methods:
Linked Tables and ViewsThe most efficient way to handle server data is to link tables and views from your server. Microsoft Access stores field and index information for linked tables. This improves performance when you open the tables.NOTE: If you make changes to fields or indexes on the server, you must relink the remote tables in Access. Running SQL Pass-Through QueriesIn many applications, you can create Microsoft Access queries based on remote tables and also create SQL pass-through queries. Pass-through queries offer the following advantages:
Request Less Data from the ServerRequesting data from the server costs processing time. To optimize performance, request only those records and fields that you need.Reduce the number of bound controls, such as text boxes, combo boxes, list boxes, and subforms. When a form is opened, each of these controls sends a separate query to the server. If the linked ODBC tables have Memo or OLE object fields, you can set the Visible property of the fields to No and add a toggle button to set the Visible property to Yes so that users can choose to view it. Some linked tables do not change frequently. For example, a table containing the names and abbreviations of the 50 states would not change often. You can speed up form loading and reduce server load by storing a local copy of these tables. You can also provide a way to update the local copy with more recent data from the server. Optimizing QueriesThe principal method for optimizing queries (after adding appropriate indexes on the server) is ensuring that processing takes place on the server. You should avoid functionality that is not supported by the server, such as functions specific to Microsoft Access or user-defined functions. For detailed information about what must be processed locally, see the Microsoft Jet Database Engine ODBC Connectivity white paper (for more information about this white paper, see the "Microsoft Jet Database Engine ODBC Connectivity White Paper" section later in this article).To see the Select statement that is being sent to the server, you can set the TraceSQLMode setting. To set this, follow these steps:
TryJetAuth SettingThe TryJetAuth setting controls whether Microsoft Access first attempts to log on to your server using the Microsoft Access login ID and password. (By default, the Microsoft Access login ID is "admin" and the password is blank.) If this fails, Microsoft Access prompts you for a logon ID and password. Unless you have set up Microsoft Access to use the same logon ID and password as your ODBC server, add the line "TryJetAuth=0" to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\ODBC\TryJetAuth key of the registry. This prevents Microsoft Access from attempting to log on with the wrong ID. To do this, follow these steps:
TimestampsOn servers that support them such as Microsoft SQL Server, timestamp fields make updating records more efficient. Timestamp fields are maintained by the server and are updated every time that the record is updated.If you have a timestamp field, Microsoft Access needs to check only the unique index and the timestamp field to see whether the record has changed since it was last retrieved from the server. Otherwise, Microsoft Access must check all the fields in the record. If you add a timestamp field to an linked table, relink the table in order to inform Microsoft Access of the new field. TransactionsUsing transactions in Visual Basic for Applications (VBA) when you update or insert records on linked tables can improve performance. Transactions enable the Jet database engine to accumulate multiple updates and write them as a single batch. With Microsoft SQL Server, keep transactions short because they generate locks that prevent other users from reading data affected by the current transaction. Although you can nest transactions with VBA, most servers do not support nested transactions. Microsoft Access sends only the first-level transaction to the server.Optimizing Recordsets and CodeYou can store all or part of the data contained in Recordset objects of the Dynaset type in local memory by setting the CacheSize and CacheStart properties.The cache size can be between 5 and 1200 records. If the size of the cache exceeds available memory, the excess records spill into a temporary disk file. Applying the FillCache method fills the cache with server data. To recover the cache memory, set the CacheSize property to zero. With Recordset variables, implement only the functionality that you need. For example, add the dbAppendOnly option with the OpenRecordset method if you only need to add new records to a recordset. If you do not need editing or updating ability, base your recordsets on SQL pass-through queries. The fastest method to insert and update records is to use SQL pass-through queries in code. MSysConf TableYou can create a table named MSysConf on your server to control background population (the rate at which Microsoft Access reads records from the server during idle time). With this table, you can set the number of rows of data that are retrieved at one time and the number of seconds of delay between each retrieval. If you experience excessive read-locking on the server, you can adjust the table settings to increase background population speed. If too much network traffic is generated by background population, you can adjust the settings to slow it down.Microsoft Jet Database Engine ODBC Connectivity White PaperAn important source for additional information is the "Jet Database Engine ODBC Connectivity" white paper. This document was written for Jet 3.0; however, this information still applies to Jet 4.0. This document discusses the Microsoft Jet 3.0 database engine and how it uses ODBC. The white paper can be downloaded from the following Microsoft Web site:http://download.microsoft.com/download/access95/whitep5/1/W98/EN-US/Rjwpv3.exe
(http://download.microsoft.com/download/access95/whitep5/1/w98/en-us/rjwpv3.exe)
An Access ProjectAn Access project uses OLEDB to link to Microsoft SQL Server 6.5 or 7.0. If all of the tables in your Access database are linked tables to SQL Server, to enhance performance you can instead create an Access project. However, if your database contains any Access tables, this option is not possible.
| Article Translations
|
Back to the top
