Create and use an index to improve performance (2024)

If you often search a table in Access or sort its records by a particular field, you can speed up these operations by creating an index for the field. Access uses indexes in a table as you use an index in a book: to find data, Access looks up the location of the data in the index. In some instances, such as for a primary key, Access automatically creates an index for you. At other times, you might want to create an index yourself.

This article introduces indexes and covers how to decide which fields to index, and how to create, delete, or change an index. It also explains the conditions under which Access automatically creates indexes.

In this article

  • What is an index?

  • Decide which fields to index

  • Create an index

  • Delete an index

  • View and edit indexes

  • Automatic index creation

Note:You cannot use the methods described by this article to create an index for a table in a web database. Performance of a web database depends on the performance of several factors such as the SharePoint server that is hosting the web database.

What is an index?

You can use an index to help Access find and sort records faster. An index stores the location of records based on the field or fields that you choose to index. After Access obtains the location from the index, it can then retrieve the data by moving directly to the correct location. In this way, using an index can be considerably faster than scanning through all of the records to find the data.

Decide which fields to index

You can create indexes that are based on a single field or on multiple fields. You'll probably want to index fields that you search frequently, fields that you sort, and fields that you join to fields in other tables in multiple table queries. Indexes can speed up searches and queries, but they can slow down performance when you add or update data. When you enter data in a table that contains one or more indexed fields, Access must update the indexes each time a record is added or changed. Adding records by using an append query or by appending imported records is also likely to be slower if the destination table contains indexes.

Note:The primary key of a table is automatically indexed.

You cannot index a field whose data type is OLE Object, Calculated, or Attachment. For other fields, consider indexing a field if all of the following apply:

  • The field's data type is Short Text (Text in Access 2010), Long Text (Memo in Access 2010), Number, Date/Time, AutoNumber, Currency, Yes/No or Hyperlink.

  • You anticipate searching for values stored in the field.

  • You anticipate sorting values in the field.

  • You anticipate storing many different values in the field. If many of the values in the field are the same, the index might not significantly speed up queries.

Multiple-field indexes

If you think that you'll often search or sort by two or more fields at a time, you can create an index for that combination of fields. For example, if you often set criteria for the Vendor and ProductName fields in the same query, it makes sense to create a multiple-field index on both fields.

When you sort a table by a multiple-field index, Access sorts first by the first field defined for the index. You set the order of the fields when you create a multiple-field index. If there are records with duplicate values in the first field, Access sorts next by the second field defined for the index, and so on.

You can include up to 10 fields in a multiple-field index.

Create an index

To create an index, you first decide whether you want to create a single-field index or a multiple-field index. You create an index on a single field by setting the Indexed property. The following table lists the possible settings for the Indexed property.

Indexed property setting

Meaning

No

Don't create an index on this field (or delete the existing index)

Yes (Duplicates OK)

Create an index on this field

Yes (No Duplicates)

Create a unique index on this field

If you create a unique index, Access doesn't allow you to enter a new value in the field if that value already exists in the same field in another record. Access automatically creates a unique index for primary keys, but you might also want to prohibit duplicate values in other fields. For example, you can create a unique index on a field that stores serial numbers so that no two products have the same serial number.

Create a single-field index

  1. In the Navigation Pane, right-click the name of the table that you want to create the index in, and then click Design View on the shortcut menu.

  2. Click the Field Name for the field that you want to index.

  3. Under Field Properties, click the General tab.

  4. In the Indexed property, click Yes (Duplicates OK) if you want to allow duplicates, or Yes (No Duplicates) to create a unique index.

  5. To save your changes, click Save on the Quick Access Toolbar, or press CTRL+S.

Create a multiple-field index

To create a multiple-field index for a table, you include a row for each field in the index and include the index name only in the first row. Access treats all rows as part of the same index until it comes to a row containing another index name. To insert a row, right-click the location where you want to insert a row, and then click Insert Rows on the shortcut menu.

  1. In the Navigation Pane, right-click the name of the table that you want to create the index in, and then click Design View on the shortcut menu.

  2. On the Design tab, in the Show/Hide group, click Indexes.

    The Indexes window appears. Resize the window so that some blank rows appear and the index properties are shown.

  3. In the Index Name column, in the first blank row, type a name for the index. You can name the index after one of the index fields, or use another name.

  4. In the Field Name column, click the arrow and then click the first field that you want to use for the index.

  5. In the next row, leave the Index Name column blank, and then, in the Field Name column, click the second field for the index. Repeat this step until you select all the fields that you want to include in the index.

  6. To change the sort order of the field's values, in the Sort Order column of the Indexes window, click Ascending or Descending. The default sort order is Ascending.

  7. In the Indexes window, under Index Properties, set the index properties for the row in the Index Name column that contains the name of the index. Set the properties according to the following table.

    Label

    Value

    Primary

    If Yes, the index is the primary key.

    Unique

    If Yes, every value in the index must be unique.

    Ignore Nulls

    If Yes, records with a Null value in the indexed fields are excluded from the index.

  8. To save your changes, click Save on the Quick Access Toolbar or press CTRL + S.

  9. Close the Indexes window.

Delete an index

If you find that an index becomes unnecessary or is having too great an impact on performance, you can delete it. When you delete an index, you remove only the index and not the field or fields on which it is built.

  1. In the Navigation Pane, right-click the name of the table that you want to delete the index in, and then click Design View on the shortcut menu.

  2. On the Design tab, in the Show/Hide group, click Indexes.

    The Indexes window appears. Resize the window so that some blank rows appear and the index properties are shown.

  3. In the Indexes window, select the row or rows that contain the index that you want to delete, and then press DELETE.

  4. To save your changes, click Save on the Quick Access Toolbar or press CTRL + S..

  5. Close the Indexes window.

View and edit indexes

You might want to see the indexes for a table to weigh their impact on performance, or to ensure that particular fields are indexed.

  1. In the Navigation Pane, right-click the name of the table that you want to edit the index in, and then click Design View on the shortcut menu.

  2. On the Design tab, in the Show/Hide group, click Indexes.

    The Indexes window appears. Resize the window so that some blank rows appear and the index properties are shown.

  3. View or edit the indexes and index properties to suit your needs.

  4. To save your changes, click Save on the Quick Access Toolbar or press CTRL + S..

  5. Close the Indexes window.

Automatic index creation

In some instances, Access automatically creates indexes for you. For example, an index is automatically created for any field or fields that you designate as a table's primary key.

Another source of automatic index creation is the AutoIndex on Import/Create option in the Access Options dialog box. Access automatically indexes any fields with names that begin or end with the characters entered in the AutoIndex on Import/Create box, such as ID, key, code, or num. To see or change the current setting, take the following steps:

  1. Click File > Options.

  2. Click Object Designers and then, under Table design, add, edit, or remove values in the AutoIndex on Import/Create box. Use a semicolon (;) to separate values.

    Note:If a field name begins or ends with a value listed in the box, the field is automatically indexed.

  3. Click OK.

Because each additional index requires Access to do additional work, performance decreases when adding or updating data. You might, therefore, want to consider altering the values shown in the AutoIndex on Import/Create box or reducing the number of values to minimize the number of indexes created.

Top of Page

Create and use an index to improve performance (2024)

FAQs

Create and use an index to improve performance? ›

By creating an index, the database engine can quickly locate the rows that match the search conditions, decreasing the time required to extract data. Improved Query Performance: Indexing allows the database to quickly retrieve data from large tables, reducing the time it takes to run queries.

How to create an index to improve performance? ›

A primary index, created automatically with a primary key, ensures unique identification and sorting of rows by the key. Secondary indexes, created manually on non-primary key columns, enhance the speed of queries involving filtering, joining, or sorting by those columns. They can be clustered or non-clustered.

What are the benefits of creating an index? ›

Indexing makes columns faster to query by creating pointers to where data is stored within a database. Assume you need to locate a specific piece of data in a huge database. To retrieve this data from the database, the machine will search every row until it finds it.

What is the CREATE INDEX used for? ›

The CREATE INDEX statement is used to create indexes in tables. Indexes are used to retrieve data from the database more quickly than otherwise. The users cannot see the indexes, they are just used to speed up searches/queries.

How do you create an index for a report? ›

Click where you want to add the index. Go to References > Insert Index. In the Index dialog box, you can choose the format for text entries, page numbers, tabs, and leader characters. You can change the overall look of the index by choosing from the Formats dropdown menu.

What is a good performance index? ›

A great key performance indicator should accomplish all the following: Outline and measure your organization's most important set of outputs. Work as the heartbeat of your performance management process and confirm whether progress is being made against your strategy.

How do you make a good index? ›

Summary of how to index (if not using Word index functionality at manuscript preparation stage)
  1. Make a list of terms to appear.
  2. Separate these terms into main entries and subentries.
  3. Add the page numbers for every meaningful reference to a selected term.
  4. Alphabetize all main entries and main words of subentries.
Sep 23, 2021

What is the main purpose of an index? ›

An index is a list of all the names, subjects and ideas in a piece of written work, designed to help readers quickly find where they are discussed in the text. Usually found at the end of the text, an index doesn't just list the content (that's what a table of contents is for), it analyses it.

What are the pros and cons of index? ›

Index funds are a low-cost way to invest, provide better returns than most fund managers, and help investors to achieve their goals more consistently. On the other hand, many indexes put too much weight on large-cap stocks and lack the flexibility of managed funds.

Why is index so important? ›

Indexes are also created to measure other financial or economic data such as interest rates, inflation, or manufacturing output. Indexes often serve as benchmarks against which to evaluate the performance of a portfolio's returns.

What are the purposes and uses of index? ›

Index numbers in measurement and index statistics are commonly used to measure things such as inflation, cost of goods sold (COGS), stocks, and other economic indicators. There are many different types of index numbers, but two famous examples are the Consumer Price Index (CPI) and Dow Jones Industrial Average (DJIA).

What does CREATE INDEX include do? ›

INCLUDE (column [ ,... n ] )

Specifies the non-key columns to be added to the leaf level of the nonclustered index. The nonclustered index can be unique or non-unique. Column names can't be repeated in the INCLUDE list and can't be used simultaneously as both key and non-key columns.

What is the purpose of index method? ›

The Python index() method helps you find the index position of an element or an item in a string of characters or a list of items. It spits out the lowest possible index of the specified element in the list. In case the specified item does not exist in the list, a ValueError is returned.

What is the first step in creating an index? ›

The first step in creating an index is selecting the items you wish to include in the index to measure the variable of interest. There are several things to consider when selecting the items. First, you should select items that have face validity. That is, the item should measure what it is intended to measure.

How do you develop an index? ›

There are four steps for constructing an index: 1) selecting the possible items that represent the variable of interest, 2) examining the empirical relationship between the selected items, 3) providing scores to individual items that are then combined to represent the index, and 4) validating the index.

What programs create an index? ›

Dedicated Indexing Software
  • Cindex. Platform: Windows, Mac. ...
  • Index Manager. Platform: Windows, Mac. ...
  • Macrex. Platform: Windows. ...
  • SKY Index Professional™ Platform: Windows. ...
  • TExtract. Platform: Windows. ...
  • Picardy 2.0. Platform: Windows, Linux; beta version for Intel Macs. ...
  • HTML Indexer™ Platform: Windows. ...
  • IndexAssistant. Platform: MS Word.

How do you create an index to measure something? ›

Steps for Construction of Indices
  1. Selection of Possible Items. To illustrate the selection of items for an index in order to measure a complex construct, we will use a set of items about the knowledge of healthy food (Table 1). ...
  2. Examination of the Empirical Relationship between Items. ...
  3. Scoring of Items. ...
  4. Validation of Index.

How to create a data index? ›

An index is an accumulation of scores from a variety of individual items. To create one, you must select possible items, examine their empirical relationships, score the index, and validate it.

How do I recreate an index? ›

To rebuild an index (SQL)
  1. Connect to the database as a user with DBA authority, or as the owner of the table associated with the index.
  2. Execute an ALTER INDEX ... REBUILD statement.

How do you optimize an index? ›

Recap on Index Optimization:
  1. Single-Column Indexes: An index on a single column is effective for filtering data based on that column's values. ...
  2. Multi-Column Indexes: In scenarios where queries involve filtering by multiple columns or sorting by one column, a multi-column index can be advantageous.
Sep 11, 2023

Top Articles
Latest Posts
Article information

Author: Kelle Weber

Last Updated:

Views: 6337

Rating: 4.2 / 5 (73 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Kelle Weber

Birthday: 2000-08-05

Address: 6796 Juan Square, Markfort, MN 58988

Phone: +8215934114615

Job: Hospitality Director

Hobby: tabletop games, Foreign language learning, Leather crafting, Horseback riding, Swimming, Knapping, Handball

Introduction: My name is Kelle Weber, I am a magnificent, enchanting, fair, joyous, light, determined, joyous person who loves writing and wants to share my knowledge and understanding with you.