XL: How to Create an Index with Microsoft Query

Last reviewed: February 2, 1998
Article ID: Q143348

The information in this article applies to:
  • Microsoft Excel for Windows 95, version 7.0
  • Microsoft Excel for Windows, version 5.0
  • Microsoft Excel 97 for Windows
  • Microsoft Excel for the Macintosh, version 5.0
  • Microsoft Excel 98 Macintosh Edition

SUMMARY

This article describes how to create indexes with Microsoft Query.

MORE INFORMATION

Indexes can make queries run more quickly. To improve query performance, you can create indexes for fields that are used in joins, criteria, and sorts.

The more unique a field's entries are, the more an index for that field can improve query performance. For example, an index for a field of phone numbers will improve query performance more than an index for a field containing only Yes or No entries.

To create an index with Microsoft Query, follow these steps:

  1. On the File menu, click Table Definition.

  2. In the Select Data Source dialog box, select a data source and then click Use (in versions 5.0 and 7.0) or click OK (in version 97).

  3. In the Select Table dialog box, select a table and then click Index.

  4. In the Create Index dialog box, under Index Name, type a name for the index (the index name can be any name).

  5. Select the field to be indexed. Depending on the ODBC driver you are using, you may be able to index on multiple fields, or index on an expression. For example, your ODBC driver may allow you to enter either of the following:

    LAST_NAME,FIRST_NAME RATE*INTEREST

  6. Ensure that the Unique Index box is selected, and then click Add. Note that you receive the following message:

    Index was created successfully.

    If you receive an error message, click to clear the Unique Index box.

  7. Click OK.

  8. Repeat steps 5 through 7 for any other fields that you want to be indexed on that table.

  9. Click Close.

  10. Repeat steps 3 through 9 for any other tables with fields that you want to be indexed.

When you run your query again, you may receive better performance.

Note that indexes can make data entry slower because the indexes are updated each time data is entered. If you find that your indexes are slowing down the data entry process, delete indexes for fields which contain few unique entries. For example, if a field of phone numbers is used in a criteria, create an index for it because there are many unique entries. But if 10 fields, each containing only a Yes or a No entry, are used in criteria, you may prefer not to create indexes for these fields because they will do little to improve query performance and may slow down data entry.

REFERENCES

For more information about creating indexes in Microsoft Query, click the Search button in Microsoft Query Help and type:

   Create Index Dialog Box


Additional query words: idx indexing fast slow long time msquery
Keywords : xlquery kbtool
Version : WINDOWS:5.0,7.0,97; MACINTOSH:5.0,5.0a,98
Platform : MACINTOSH WINDOWS
Issue type : kbhowto


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: February 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.