Tuning spatial indexes |
|
Release 9.3 |
NOTE: This topic deals with spatial grid indexes. Spatial grid indexes are used with tables using binary geometry in Oracle and SQL Server and tables using ST_Geometry in Oracle. IBM DB2 Spatial Extender also uses a multilevel grid spatial index, but since the spatial index in DB2 is generated by the Spatial Extender, you should use the Index Advisor tool provided by IBM to help tune this index. You can read more about this tool at IBM's Information Center.
The multilevel spatial index is used to decrease the time it takes to locate features that match a spatial query. It defines imaginary x/y grids for a feature class. There may be one, two, or three of these grid levels defined per feature class. The size of each grid in an ArcSDE feature class must be at least three times the previous grid size. Most feature classes need only one grid level, but more levels may be needed if the average sizes of the feature envelopes (the bounding boxes of each feature) vary widely. For more information on spatial indexes, see An overview of spatial indexes in the geodatabase in the "Defining the properties of a geodatabase" section of the help. Each feature in the feature class is indexed using only one of the grid levels; small features are indexed in the first level and larger features in the second or third grid levels, if these levels are present. ArcSDE places an entry (a row) in the spatial index table for every instance in which a single feature intersects a single cell in the one grid level used for that feature. When spatial data is displayed or previewed in ArcGIS, ArcSDE performs filtering to return only those features that fall within the envelope of the display extent.NOTE: If the Recalculate button is not active, you are likely using a geometry storage type that does not use a spatial grid index or you are not the owner of the dataset or an administrator in the database.
ArcGIS 9.1 and earlier releasesIf you are using an older release of ArcGIS and ArcSDE (9.1 or lower) and are using spatial grid indexes, you likely defined the spatial index yourself or used the default grid size settings. The default grid size settings are designed to ensure that the data can be loaded. In most circumstances, the default grid sizes will be appropriate for fast spatial queries. However, depending on the characteristics of your data, they may not be the optimal size. Tuning the grid sizes might result in better spatial query performance. When you tune the spatial index, you must balance selectivity against reducing the number of entries in the spatial index. The greater the number of entries in the spatial index, the fewer features there will be in the result sets, which the secondary spatial filter must examine and possibly eliminate to meet the requirements of the spatial query. However, the more spatial index entries there are, the larger the spatial index will be, which will slow down queries on the spatial index table. When performance tuning, the only way to tell if you have made a positive change is to monitor the results of each change. ArcSDE provides statistics about the spatial index which, along with performance testing, can ease the tuning process. The administration command sdelayer –o si_stats is the primary tool for reporting spatial index grid statistics used to tune the spatial index. If you feel you need to tune your spatial index, you can follow the steps below.NOTE: Building a new spatial index for an ArcSDE feature class is a server-intensive operation; you should not do it for very large feature classes when a large number of users are logged in to the server.
NOTE: Applies to geodatabases created with an ArcGIS Server Enterprise license only
The general steps to follow when tuning a spatial index are as follows:sdelayer –o si_stats –l <business_table,spatial_column>
[–i <service>] [–s <server_name>] [–D <database>]
–u <DB_user_name> –p <DB_user_password> [–q]
NOTE: If you are not the owner of the table/feature class, you must qualify the table name with the owner name, for example, owner.table.
The following is an example of what gets returned by sdelayer –o si_stats:Layer Administration Utility
Layer 5 Spatial Index Statistics:
Level 1, Grid Size 4.940464025
Grid Records: 966
Feature Records: 23
Grids/Feature Ratio: 42
Avg. Features per Grid: 16.37
Max. Features per Grid: 96
% of Features Wholly Inside 1 Grid: 59.71
Spatial Index Record Count By Group
Grids: <=4 >4 >10 >25 >50 >100 >250 >500
Features: 23 0 0 0 0 0 0 0
% Total: 100% 0% 0% 0% 0% 0% 0% 0%
sdelayer –o load_only_io –l <table,column>
[–i <service>] [–s <server_name>] [–D <database>]
[–u <DB_user_name>] [–p <DB_user_password>] [–q]
sdelayer –o alter –l <table,column> –g {<grid_sz1>[,<grid_sz2>[,<grid_sz3>]]}
[–S <layer_description_str>] [–i <service>] [–s <server_name>]
[–D <database>] –u <DB_User_name> [–p <DB_User_password>] [–N] [–q]
sdelayer –o normal_io –l <table,column>
[–i <service>] [–s <server_name>] [–D <database>]
[–u <DB_user_name>] [–p <DB_user_password>] [–q]
Tips
|