The faster Microsoft Access runs, the faster your application runs, too. You can significantly improve your application’s performance by making sure that Microsoft Access has the memory it requires and that it uses memory efficiently for the types of operations your application performs. This is true whether your application runs under full Microsoft Access or as a Microsoft Access run-time application.
This section suggests ways to configure your computer and Microsoft Access for best use of memory. If you don’t control the configuration of your application users’ computers, you may want to pass some of these suggestions on to them when you deliver your application.
Because database operations are faster when Microsoft Access can perform them in random-access memory (RAM), the performance of Microsoft Access depends largely on the amount of RAM available. To run by itself, Microsoft Access requires a minimum of 12 megabytes (MB) of RAM for Windows, or 16 MB of RAM for Windows NTâ Workstation. The amount of memory Microsoft Access needs to run at top speed depends on a variety of factors, such as how many other applications are running at the same time and what types of operations your application performs. When other applications are competing for memory, you can usually improve performance significantly by running with more than the required amount. Similarly, if your Microsoft Access application uses Automation to work with another application’s objects, you can improve the performance of your application by running with more RAM. When running with 32 MB or more of RAM, you may be able to increase performance by adjusting the MaxBufferSize setting in the Windows Registry. Make sure that you aren’t using any of your RAM for a RAM drive.
See Also For more information on the MaxBufferSize setting, see “MaxBufferSize” later in this chapter.
With virtual memory, an application sees a large, continuous block of primary memory (RAM) that, in reality, is a much smaller block of primary memory supplemented by secondary memory (such as a hard disk). To temporarily free up space in RAM, blocks of data (called pages) are moved between RAM and a swap file located on the hard disk.
By default, the Windows 95 swap file is dynamic, so it can shrink or grow based on available disk space and the operations performed on the system. Also, the swap file can occupy a fragmented region of the hard disk with no substantial performance penalty. A dynamic swap file is usually the most efficient use of resources. The simplest way to ensure high virtual memory performance is to make sure that the disk containing the swap file has ample free space so that the swap file size can shrink and grow as needed.
In Windows 3.x, enhancing performance by changing virtual memory settings is quite common. Because the Windows 95 swap file is dynamic, the need to change virtual memory settings is less common. However, in some situations adjusting virtual memory settings can improve performance. If you’ve already tried deleting unnecessary files, and you still have a performance problem, try changing the Windows 95 default virtual memory settings.
If you have more than one drive available, you may get better performance if you specify that Windows locate the swap file on a drive other than the default in the following cases:
You also may get better performance if you specify the minimum disk space available for virtual memory to be at least 25 MB minus available RAM. For example, if your computer has 12 MB of RAM, you should specify at least 13 MB of virtual memory. You may want to specify more if you are running several large applications.
See Also For information on changing Windows 95 virtual memory settings, search the Windows 95 Help index for “virtual memory settings.”
Each time you add or update data, your database grows. But when you delete data, the database doesn’t automatically get smaller. Microsoft Access makes empty data pages available for reuse after you close a database, so the next time you open the database they are available to be filled with new records. If left unused, empty data pages remain in the database until you compact it. Compacting the database frees unused disk space, makes all data pages contiguous, and, if a primary key is defined for a table, saves its records in primary key order. For databases in which records are frequently added, deleted, and updated, you should compact frequently.
Note If your database is a replica, you must compact it twice to reclaim all available space. Additionally, if your database is the Design Master in a replica set, you must take certain precautions when compacting it to prevent it from losing its Design Master status. For more information on replication, see Chapter 20, “Using Replication in Your Application.”
See Also For more information on compacting databases, see “Compacting a Database” in Chapter 15, “Delivering Your Application.”
In addition, you should occasionally use a utility such as the Windows Disk Defragmenter to defragment the hard disk after you compact it. This increases efficiency by making your database file contiguous on the hard disk.
If you have a wallpaper (full-screen background) bitmap on your Windows desktop and don’t have memory to spare, replace your wallpaper with a solid color or pattern bitmap, or don’t use a bitmap.