HOW TO
Instructions provided describe how to set user-defined statistics for st_geometry attributes and st_spatial_index in Oracle. Statistics are used by the Oracle optimizer to select the best access path for data retrieval when executing a SQL statement. St_geometry and st_spatial_index objects also have statistics that are used by the st_domain_stats type to help the Oracle optimizer determine if a spatial index should be used or not as the access path.
Statistics are gathered on tables and indexes when the table is analyzed, either by using the Analyze command in ArcCatalog or the Oracle command dbms_stats.gather_table_stats. When statistics are gathered on a table containing an st_geometry attribute and spatial index, additional statistics are gathered about the geometry and its spatial index, which are stored in the ArcSDE administrator's table st_geometry_index. These statistic values are then used to derive the selectivity of spatial queries and the cost of using the spatial index as the optimizer's access path, verses a full table scan and filter for each candidate row.
In some unique and specific cases, the statistics gathered may not correctly represent the characteristics of the data. Therefore, just as Oracle provides a mechanism to set user-defined statistics with tables and indexes, there is the ability to set an st_geometry and spatial index statistics using the sde.spx_util procedure.
By changing the st_geometry or st_spatial_index statistic values for a table, it influences the optimizer on the cost of using the spatial index and what access path is selected when executing a SQL statement that includes spatial relational operators.
If user statistics have been set, when the next table statistics are gathered on the table, the user defined statistic values will be over written.
Code:
sde.spx_util.set_column_stats
(owner IN VARCHAR2,
table_name IN VARCHAR2,
column_name IN VARCHAR2,
distcnt IN NUMBER DEFAULT NULL,
nullcnt IN NUMBER DEFAULT NULL)
sde.spx_util.set_index_stats
(owner IN VARCHAR2,
table_name IN VARCHAR2,
index_name IN VARCHAR2,
numrows IN NUMBER DEFAULT NULL,
numlblks IN NUMBER DEFAULT NULL,
clstfct IN NUMBER DEFAULT NULL,
density IN NUMBER DEFAULT NULL,
indlevel IN NUMBER DEFAULT NULL)
Code:
SQL> EXECUTE sde.spx_util.set_column_stats('tb','transformers','shape',NULL,3500);
PL/SQL procedure successfully completed.
Code:
SQL> EXECUTE sde.spx_util.set_index_stats('tb','poles','poles_shp_idx',NULL,NULL,NULL,125);
PL/SQL procedure successfully completed.
Article ID: 000009242
Get help from ArcGIS experts
Download the Esri Support App