Microsoft Access Tip: Avoid Unnecessary or Duplicate Indexes with the AutoIndex Setting

Provided by: Luke Chung, President of FMS, Inc.

Microsoft Access Automatically Creates Secondary Indexes

We all want speed and faster performance in Microsoft Access. As tables get larger, secondary indexes can help speedup queries, searches, and links between tables.

By default, Microsoft Access has a setting that automatically adds secondary indexes on fields based on their name. Unfortunately, this can create additional problems.

By default, Access automatically adds a secondary index to fields that begin or end with these names:

  • ID
  • key
  • code
  • num

These are set in the options AutoIndex on Import/Create separated by semicolons:

ID;key;code;num

Microsoft Access 2010, 2013, and 2016

For Microsoft Access 2010 and later, this option is under File, Options, Object Designers:

AutoIndex on Import/Create for Microsoft Access 2010, 2013 or 2016

Microsoft Access 2007

For Microsoft Access 2007, this option is under the Office button, Access Options, Object Designers:

AutoIndex on Import/Create for Microsoft Access 2007

Microsoft Access 2003 and Earlier

For Microsoft Access versions before Access 2007, the setting is on the Tables/Queries tab under the Access Tools/Options menu:

AutoIndex on Import/Create for Microsoft Access 2003

Why This is a Problem

Adding too many indexes to a table and duplicating indexes on the same field can hurt performance and increase your database size.

  • Not every field name that begins or ends with the default values should have a secondary index.
  • Some fields have only a few unique values, so secondary indexes on those fields are not very helpful
  • Some fields that aren't named that way may need secondary indexes, so using the default setting is not a wise solution since thought should be put into this.
  • Some secondary indexes may involve more than one field, so single field indexes may not be helpful.

Significant Problems on Table Import

When you import a table with these settings, the indexes are added to your new table automatically. That may be fine for a brand new table, but if you are importing a table to replace an existing table (from a backup) or creating a new database by importing all the tables from an existing database, a whole set of new secondary indexes may be added unnecessarily -- essentially undoing the work you may have done to determine which fields shouldn't have indexes.

Solution

If you understand when to add secondary indexes on your tables, you should set the AutoIndex on Import/Create option to nothing. This lets you control where and when indexes are added, and eliminates it from happening by chance:

Blank AutoIndex Setting

If you have our Total Access Analyzer program, this setting is one of the ~300 issues detected when your database is documented. Learn more about how Total Access Analyzer can help you create better Microsoft Access applications.

Table Design

Query Design

Form Design

Form Tips and Mistakes

Module VBA to Forms and Controls

Form Navigation Caption

Using a RecordsetClone

Synchronize Two Subforms

Multiple OpenArgs Values

Late Bind Tab Subforms

Subform Reference to Control Rather than Field

Tab Page Reference

Shortcut Keys


Combo Box Top Tips

Properties and Validation

Select First Item

Cascading Combo Boxes

Zip, City, State AutoFill

Report Design

Suppressing Page Headers and Footers on the First Page of Your Report

Add the NoData Event

Annual Monthly Crosstab Columns

Design Environment

Adding Buttons to the Quick Access Toolbar

Collapsing the Office Ribbon for more space

VBA Programming

Basics: Forms and Controls

Using Nz() to Handle Nulls

Avoiding Exits in the Body of a Procedure

Shortcut Debugging Keys

Setting Module Options

Math Rounding Issues

Rename a File or Folder

Avoid DoEvents in Loops

Age Calculations

Weekday Math

Sending Emails with DoCmd.SendObject

Source Code Library

Microsoft Access Modules Library

Microsoft Access Modules

VBA Error Handling

Error Handling and Debugging Techniques

Error Number and Description Reference

Basic Error Handling

Pinpointing the Error Line

Performance Tips

Linked Database

Subdatasheet Name

Visual SourceSafe

Deployment

Runtime Downloads

Simulating Runtime

Prevent Close Box

Disable Design Changes

Broken References

Remote Desktop Connection Setup

Terminal Services and RemoteApp Deployment

Reboot Remote Desktop

Missing Package & Deployment Wizard

Avoid Program Files Folder

Microsoft Access Front-End Deployment

System Admin

Disaster Recovery Plan

Compact Database

Compact on Close

Database Corruption

Class Not Registered Run-time Error -2147221164

Inconsistent Compile Error

Decompile Database

Bad DLL Calling Convention

Error 3045: Could Not Use

Converting ACCDB to MDB

SQL Server Upsizing

Microsoft Access to SQL Server Upsizing Center

Microsoft Access to SQL Server Upsizing Center

When and How to Upsize Access to SQL Server

SQL Server Express Versions and Downloads

Cloud and Azure

Cloud Implications

MS Access and SQL Azure

Deploying MS Access Linked to SQL Azure

Visual Studio LightSwitch

LightSwitch Introduction

Comparison Matrix

Additional Resources

Connect with Us

 

Free Product Catalog from FMS