Spatial indexes in the geodatabase

ArcGIS AllSource uses spatial indexes to improve spatial query performance on feature classes. Identifying a feature, selecting features by pointing or dragging a box, and panning and zooming all require ArcGIS AllSource to use the spatial index to locate features.

Note:

When you open the attribute table in ArcGIS AllSource, fields that are indexed have an asterisk (*) by their name.

When you create an empty feature class or import data to create a feature class in a geodatabase from ArcGIS AllSource, a spatial index is created on the feature class. The spatial index is used when querying and editing data.

Note:

The exception to this is Db2. When you create empty feature classes in geodatabases in Db2, spatial indexes are not created.

Spatial index types

Spatial indexes differ depending on the data source. The following list of spatial index types contains the geodatabase data sources that use this index on its feature classes:

  • Grid-based spatial index
    • File geodatabases
    • Geodatabases in Db2
    • Geodatabases in Oracle if the feature class contains an Esri ST_Geometry column
  • R-tree spatial index
    • Mobile geodatabases
    • Geodatabases in Oracle that contain feature classes with an Oracle Spatial (SDO_Geometry) data type
  • Generalized Search Tree (GiST) index
    • Geodatabases in PostgreSQL
  • Modified B-tree spatial index
    • Geodatabases in Microsoft SQL Server containing feature classes that use a Geometry or Geography spatial column. The spatial index on a Geometry spatial column also stores bounding box coordinates. See the Microsoft SQL Server documentation for information about the bounding box.

Spatial index management in ArcGIS

The way ArcGIS AllSource creates or rebuilds spatial indexes depends on the type of geodatabase and, for enterprise geodatabases, varies depending on the database management system used. The next two sections explain these functionality differences.

Spatial indexes in file geodatabases

The following describes spatial indexes in file geodatabases:

  • When you create a feature class, ArcGIS AllSource creates a spatial index.
  • If you copy a feature class from a geodatabase to a file geodatabase, the spatial index is copied along with the source data if the source feature class uses a grid-based index. The spatial index is rebuilt in the destination file geodatabase if the source data uses any other index type.
  • Compressed file geodatabase feature classes do not use the same type of spatial index used in uncompressed feature classes. When you compress a file geodatabase feature class, it's automatically reindexed. This index cannot be modified. When you decompress the feature class, the same spatial index the feature class had before it was compressed is automatically reestablished.

Spatial indexes in mobile geodatabases

The following describes spatial indexes in mobile geodatabases:

  • When you create a feature class, ArcGIS AllSource creates a spatial index.
  • Saving feature edits in a feature class that does not have a spatial index does not create a spatial index.
  • If you copy a feature class from a geodatabase to a mobile geodatabase, ArcGIS AllSource creates a spatial index on the feature class in the mobile geodatabase based on the copied features.

Spatial indexes in enterprise geodatabases

The following lists describe how ArcGIS AllSource manages the spatial index on a feature class in a geodatabase in each supported database management system:

  • Db2
    • When you create a feature class, ArcGIS AllSource does not create a spatial index.
    • When you save feature edits in a feature class that does not have a spatial index, a spatial index is created.
    • If you copy a feature class from a geodatabase to a geodatabase in Db2, the spatial index is copied along with the source data if the source feature class uses a grid-based index. If the source data uses any other index type, ArcGIS AllSource creates the spatial index in the destination geodatabase in Db2 based on the copied features.
  • Oracle
    • When you create a feature class, ArcGIS AllSource creates a spatial index.
    • When you save feature edits in a feature class that does not have a spatial index, a spatial index is created.
    • If you copy a feature class from a geodatabase to a geodatabase in Oracle and you use the Esri ST_Geometry type for the feature class, the spatial index is copied along with the source data if the source feature class uses a grid-based index. If the source data uses any other index type, ArcGIS AllSource creates the spatial index in the destination geodatabase in Oracle based on the copied features.
  • PostgreSQL
    • When you create a feature class, ArcGIS AllSource creates a spatial index.
    • When you save feature edits in a feature class that does not have a spatial index, a spatial index is created.
    • If you copy a feature class from a geodatabase to a geodatabase in PostgreSQL, ArcGIS AllSource creates a spatial index on the feature class in PostgreSQL based on the copied features.
  • SQL Server
    • When you create a feature class, ArcGIS AllSource creates a spatial index.
    • Saving feature edits in a feature class that does not have a spatial index does not create a spatial index.
    • If you copy a feature class from a geodatabase to a geodatabase in SQL Server, ArcGIS AllSource creates a spatial index on the feature class in SQL Server based on the copied features.
  • SAP HANA does not use spatial indexes for query performance; therefore, ArcGIS AllSource does not create or maintain one.

When to update the spatial index

For feature classes in SQL Server that use the Geometry spatial type, the spatial index uses a bounding box that must be manually updated as features are inserted and deleted. To determine when you need to recalculate the spatial index on a feature class in SQL Server, use the Validate operation in the Feature Class Properties dialog box.

For all other geodatabases and spatial types, you seldom need to manage the spatial index. However, if you experience a decrease in spatial query performance after adding or deleting a large number of features, you may see improved spatial query performance if you rebuild (Oracle) or re-create the spatial index on the affected feature class.