ACC: Defragment and Compact Database to Improve Performance

Last reviewed: May 5, 1997
Article ID: Q92681
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SUMMARY

Novice: Requires knowledge of the user interface on single-user computers.

Defragmenting your hard drive and compacting your database will improve the performance of Microsoft Access.

MORE INFORMATION

Because the data on your hard disk becomes fragmented over time, you should run a disk-defragmentation utility (or "defragmenter") periodically. Within Microsoft Access, if you often make changes to a database, portions of the database may also become fragmented. Therefore, you should run Compact Database from within Microsoft Access periodically.

A disk defragmenter will place the database file in contiguous clusters on your hard disk, making file access faster. If you do not defragment your hard disk, the operating system may have to go to several physical locations on the disk to retrieve the database file, making file access slower.

Running the Compact Database command may also improve the performance of Microsoft Access. Compact Database makes a copy of the database file and, if it is fragmented, rearranges how the database file is stored on disk. The compacted database file is usually smaller than the original. Compacting can also speed up queries because it writes all the data in a table into contiguous pages on the hard disk. Scanning sequential pages is much faster than scanning fragmented pages.

You can use the original name for the compacted database file, or you can use a different name to create a separate file. If you use the same name and the database is compacted successfully, Microsoft Access automatically replaces the original file with the compacted version.

Limitations of Compacting

  • For the compact operation to succeed, you must have enough storage space on your disk for both the original and the compacted database.
  • You cannot compact an open database. In a multiuser environment, the compact operation fails if another user has the database open.

    NOTE: In Microsoft Access 97, you can compact a database while it is open, as long as the database has been opened exclusively.

Defragment or Compact First?

If you compact a database after running a defragmenter, you theoretically leave open disk space immediately after the .MDB file on the disk, allowing the operating system to place any additional information in the succeeding physical clusters. This would be very fast. However, if you defragment after running Compact Database, your .MDB may be placed on the first part of the disk followed by the rest of your files, with no open disk space until the end (the inside tracks) of the disk. This makes disk access somewhat slower.

REFERENCES

For more information about compacting databases, type "compacting databases" in the Office Assistant, click Search, and then click to view "Compact a database to defragment the file and free disk space."


Keywords : GnlCmp kbusage
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 5, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.