How To: Determine a spatial index size


The spatial index for an SDE geodatabase feature class makes queries with spatial filters faster. Determining the optimum spatial index is an iterative process and depends on individual feature geometries that may vary from dataset to dataset. This document demonstrates how to determine a good starting point for a spatial index for a feature class whose feature geometries are relatively uniformly sized. This document uses SDE command line and SQL*Plus. The same process can be used with SQL Server Query Analyzer.


  1. Use the sdelayer command to get the layer ID and current statistics for the layer's spatial index.

    sdelayer -o si_stats -l <layer_name>,shape -i <instance> -u <username> -p <password>

    The Layer ID will be on the third line that reads: Layer 1 Spatial Index Statistics:
  2. Start SQLPlus and log in as the owner of the layer.
  3. Calculate the average length of a feature envelope's edge and multiply by 3.

    select avg((((emaxx - eminx)+(emaxy-eminy))/2)*3) average_edge from<F_table>;

    <F_table> is F<layerID>