Bug: Recalculating the spatial index on a versioned feature class fails with "spatial index grid too small" error
There are specific workflows that can cause the recalculation of a spatial index grid to fail with the following error message:
"Failed to add spatial index. Spatial index grid is too small."
ArcGIS has built-in checks for the limits to the number of features allowed per grid. This is to avoid spatial query performance issues for inappropriate grid size calculations. When the spatial index is recalculated on a versioned feature class, the index is calculated based on the features currently in that version. However, when the index is applied, it is applied to the non-versioned feature table, which could have different representations and numbers of features than those in a specific version.
While ArcGIS is recalculating the correct grid size, it is based on a versioned representation of those features and might not be an ideal grid size for all the features in the feature table.
The cause of the bug is an application of an invalid grid size to the non-versioned feature table.
The workaround for this issue is to generate the spatial grid index from the ArcSDE command line using the sdelayer ALTER operation.
- Use the sdelayer describe_long operation to determine what state the class is in.
To examine the current status of the spatial index of a feature class, use the following command line syntax:
sdelayer –o describe_long -l myFC,shape
- If the feature class is in load_only_io mode, the spatial index is not generated. Instead, the layers grid index is set to 0,0,0. The spatial index is generated the next time the layer is converted to normal_io mode, which can be done using the sdelayer normal_io operation.
sdelayer –o normal_io –l myFC,shape
If the feature class is already in normal_io mode, the spatial index is generated automatically when the sdelayer ALTER operation is executed with the grid value set to 0. This can be done by the following command:
sdelayer –o alter –g 0 –l myFC,shape