I work for a county government and probably 95% of the data in the GIS database (running on Microsoft SQL Server 2014) is within the county area.
I've noticed that in some of the data the extent of the spatial indices is too large and in a few cases too small, which is causing queries to run slower than they should.
Question
Is there a way I can run down all the spatial indices and update the extent? I have the X/Y min/max for the minimum bounding rectangle of the county plus a 2 mile buffer already to plug in.
In ArcGIS there is a function to rebuild a spatial index but it doesn't alter the extent of the index. I see in the docs that I have to create a new index with the updated properties with the option of dropping the old index that has the same name. Not sure how to code this out.
Best Answer
This is generally the way that I tackle rebuilding spatial indexes in a consistent way.
This assumes that your geometries are all in the same projection and have already been indexed. It will exclude the usual ESRI Geodatabase System tables.
I avoid having ArcGIS create or maintain indexes. They never seem to get nice extents on the projections that I use.