Maintain Spatial Index (Environment setting)

Tools that honor the Maintain Spatial Index environment delete and re-create the spatial index of an ArcSDE feature class, or keep it in place and update it, according to the setting.

Maintain Spatial Index allows you to control how the spatial index for ArcSDE feature classes is managed during geoprocessing operations (such as Append and Delete_Features) that insert, update, or delete data in an existing feature class. When set to False, the spatial index of the target feature class is deleted prior to any insert, update, or delete operation. When processing is complete, the spatial index is re-created. When set to True, the spatial index of the output feature class is not deleted prior to the start of processing. It is kept in place during the insert, update, or delete operation and is automatically updated afterward. If the feature class being updated does not have a spatial index, nothing is done as far as the spatial index is concerned; a spatial index is not added. See The spatial grid index for more information on ArcSDE spatial indexes.

Usage notes

Dialog syntax

Scripting syntax

arcpy.env.maintainSpatialIndex = boolean_option




If True, the spatial index is left in place and updated after processing.

If False, the spatial index is dropped before processing and re-created at the end. This is the default.

maintainSpatialIndex syntax

Script example

import arcpy

# Set the mainttainSpatialIndex environment to True
arcpy.env.maintainSpatialIndex = True