Creating attribute indexes |
|
Release 9.3 |
NOTE: Adding or modifying attribute indexes in ArcSDE geodatabases is not available in ArcView.
Attribute indexes can speed up attribute queries on feature classes and tables. An attribute index is an alternate path used by ArcGIS to retrieve a record from a table. For most types of attribute queries, it is faster to look up a record with an index than to start at the first record and search through the entire table. Once you have data in a feature class or table, create attribute indexes for the fields you frequently query against. Create only those indexes you really need, since each index you add slightly slows edits to the feature class. Each time you edit the feature class, ArcGIS must also update the indexes. If you need to frequently edit a field, avoid creating an index for it if you can. Attribute indexes can be created by accessing the Properties dialog box in ArcCatalog or with geoprocessing. Once an index has been added, it can be deleted and added again at any time. Attribute indexes can be created in different ways. They can be created for single or multiple fields; they can be unique; and for some geodatabases, they can be created in ascending or descending order. This topic provides only a brief introduction to these concepts. If you're choosing an indexing strategy for an ArcSDE geodatabase, please refer to your DBMS documentation for more detailed guidance.NOTE: The Unique and Ascending settings are not used in file geodatabases and can be left unchecked. The Ascending setting is not used in Oracle ArcSDE geodatabases. The Unique and Ascending settings are not available for SQL Server ArcSDE geodatabases and are disabled.
NOTE: Multicolumn indexes are not supported in file geodatabases.
NOTE: The Unique option is not used in file geodatabases and can be left unchecked. The Unique option is not available for SQL Server ArcSDE geodatabases and is disabled on the Add Attribute Index dialog box.
When you create an index, you are presented with an option of creating the index as unique. Choose this option if the attribute has unique values in each record. This will speed query execution against this attribute, since the database can stop searching after the first matching value is found. Note, however, that you cannot edit a feature class that has a unique index on a user-defined field in a personal geodatabase. Also, you cannot edit a feature class that is in a feature dataset with another feature class with a unique index on a user-defined field. When attempting to start editing a personal geodatabase, ArcMap returns this error: "Could not edit any of the map's layers. Check to see if a layer or table contains a unique index on a user managed column." If you have a unique index on a field in a personal geodatabase and need to edit, use ArcCatalog to drop the unique index and re-create it as a nonunique index.NOTE: The Ascending option is not used in file or Oracle ArcSDE geodatabases and can be left unchecked. The Ascending option is not available for SQL Server ArcSDE geodatabases and is disabled on the Add Attribute Index dialog box.
When you create an index, you are presented with an option of creating the index as ascending or, if the option is not checked, as descending. An ascending index is maintained in ascending order. For example, the city names Athens, Berlin, London, and Paris would appear in that order in an ascending index, whereas in a descending index, they would appear as Paris, London, Berlin, and Athens. In almost all cases, the direction in which the index is maintained makes little or no difference to the speed of retrieval, since for most queries, indexes are traversed as efficiently forward as they are backward.NOTE: File geodatabases do not support multicolumn indexes. The Feature Class and Table Properties dialog boxes do not allow you to specify a multicolumn index. The Add Attribute Index GP tool and ArcObjects allow you to specify a multicolumn index, and although the index you create appears to be a multicolumn index when viewed from the Feature Class or Table Properties dialog box in ArcCatalog, it's actually a separate index on each field.
Indexes can be created for a single column or for multiple columns in a personal or ArcSDE geodatabase. Multicolumn indexes are useful if you frequently specify two or three fields together in a query. In this case, the multicolumn index may provide faster query performance than two or three separate indexes, one on each field. The order in which fields appear in a multicolumn index is important. In a multicolumn index with column A preceding column B, column A will be used to conduct the initial search. Also, such an index will be much more useful for queries involving column A only than it will be for queries involving column B only. Deciding whether to create multicolumn or single column indexes or a combination of both involves trade-offs and is rarely obvious. Often though, there is a variety of solutions that can work. For example, if you sometimes query only column A, sometimes only column B, and sometimes both columns, you could choose any of the following approaches: