|
DB2 uses a cost based query optimizer based on distribution statistics of the actual data. Unfortunately there is no distribution statistics for geometry attributes. As a consequence, the optimizer is not able to deal with spatial indices correctly.
The full description is here: http://www.ibm.com/developerworks/data/library/techarticle/dm-0510stolze/
It is possible to give a hint to the optimizer.
SELECT ... FROM <user_table> WHERE ST_Intersects(<indexed_shape_column>, ...) = 1
should be
SELECT ... FROM <user_table> WHERE ST_Intersects(<indexed_shape_column>, ...) = 1 SELECTIVITY 0.000001
The idea is to add a param
USESELECTIVITY
to the class DB2NGDataStoreFactory which defaults to FALSE.
If the param is TRUE, the selectivity clause will be used.
|