Hello,
I am using the ArcSDE Java api to perform a spatial query on a feature class containing 950k records. The query is taking 15+ seconds to run and returns a single result (this is correct). How can I improve the performance of the query? The version of ArcSDE is 9.3.1 and it is using an Oracle 11g database.
Here is the output of the si_stats command
ArcSDE 9.3.1 for Oracle11g Build 1632 Thu Feb 26 12:05:37 2009
Layer Administration Utility
-----------------------------------------------------
Layer 126 Spatial Index Statistics:
Level 1, Grid Size 1000
|-------------------------------------------------------------------|
| Grid Records: 1549383 |
| Feature Records: 953994 |
| Grids/Feature Ratio: 1.62 |
| Avg. Features per Grid: 11.72 |
| Max. Features per Grid: 472 |
| % of Features Wholly Inside 1 Grid: 70.03 |
|-------------------------------------------------------------------|
| Spatial Index Record Count By Group |
| Grids: <=4 >4 >10 >25 >50 >100 >250 >500 |
|---------- ------ ------ ------ ------ ------ ------ ------ ------ |
| Features: 928247 25747 4359 704 248 98 29 15 |
| % Total: 97% 3% 0% 0% 0% 0% 0% 0%|
|-------------------------------------------------------------------|
Here is the output of the stats command
ArcSDE 9.3.1 for Oracle11g Build 1632 Thu Feb 26 12:05:37 2009
Layer Administration Utility
-----------------------------------------------------
Statistics for Layer 126
--------------------------------------------------------------
Total Nil Features: 0
Total Point Features: 0
Total MultiPoint Features: 0
Total Line Features: 0
Total MultiLine Features: 437
Total SimpleLine Features: 722840
Total MultiSimpleLine Features: 230717
Total Area Features: 0
Total MultiArea Features: 0
-----------------------
Total Features: 953994
Minimum Feature Number: 1
Maximum Feature Number: 953994
Largest Feature: 3156 Points
Smallest Feature: 2 Points
Average Feature: 22.55 Points
Minimum Line String Length: 0.332415
Maximum Line String Length: 127282.943089
Average Line String Length: 394.203191
Layer Envelope:
minx: 80699.01000, miny: 6441.14000
maxx: 655562.00000, maxy: 657056.00000
This is a snippet of code that performs the spatial query
HashMap<String, LinkedList<Object>> ret = new HashMap<String, LinkedList<Object>>();
SeSqlConstruct construct = new SeSqlConstruct(layerToSearch.getQualifiedName());
SeQuery query = new SeQuery(conn, columnsToReturn, construct);
SeShapeFilter filter = new SeShapeFilter(layerToSearch.getTableName(),
layerToSearch.getSpatialColumn(),
geometry, SeFilter.METHOD_ENVP, true);
query.setSpatialConstraints(SeQuery.SE_SPATIAL_FIRST, false, new SeFilter[] { filter });
query.prepareQuery();
query.execute(); // Takes 15+ seconds
The geometry is a 100m square. The se filter method (envp,ai etc) does not seem to matter.
Any help would be much appreciated.
Harsha