Spatial indexes in the geodatabase

ArcGIS 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 Pro to use the spatial index to locate features.

When you create an empty feature class or import data to create a feature class in a geodatabase from ArcGIS, 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. Feature classes in the following geodatabase types use grid-based spatial indexes:

  • File geodatabases
  • Geodatabases in Db2
  • Geodatabases in Oracle if the feature class contains an Esri ST_Geometry column

Feature classes in Oracle that contain an Oracle Spatial (SDO_Geometry) data type use R-tree spatial indexes.

Feature classes in PostgreSQL use Generalized Search Tree (GiST) indexes.

Feature classes in Microsoft SQL Server that contain a Geometry or Geography spatial column use a modified B-tree spatial index. The spatial index on a Geometry spatial column also stores bounding box coordinates. See Microsoft SQL Server documentation for information on the bounding box.

Spatial index management in ArcGIS

The way ArcGIS 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

  • When you create a feature class, ArcGIS 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 (Oracle Esri ST_Geometry, Db2, or file geodatabase). 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 enterprise geodatabases

The following lists describe how ArcGIS 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 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 (Oracle Esri ST_Geometry, Db2, or file geodatabase). If the source data uses any other index type, ArcGIS creates the spatial index in the destination geodatabase in Db2 based on the copied features.
  • Oracle
    • When you create a feature class, ArcGIS 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 (Oracle Esri ST_Geometry, Db2, or file geodatabase). If the source data uses any other index type, ArcGIS creates the spatial index in the destination geodatabase in Oracle based on the copied features.
  • PostgreSQL
    • When you create a feature class, ArcGIS 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 creates a spatial index on the feature class in PostgreSQL based on the copied features.
  • SQL Server
    • When you create a feature class, ArcGIS 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 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 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.