Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Spatial query takes a long time to execute

$
0
0

Dear SAP,

 

I've approx 9.7 million rows, geometry is stored as ST_Geometry and only has ST_Point types.

Data is stored in SRS_ID 4326.

When I query a very small area, thing are reasonably fast (< 0.5 sec).

However when I query a larger area, where approx more than 50% of the entire set of rows will be selected, it takes a long time, more than 75 seconds.

 

I run the query from SAP HANA Modeler (but same behaviour is from ADO.NET Data Provider).

 

select shape

from gpspoint

where shape.ST_Intersects(ST_GeomFromWKT('Polygon((150 -34, 150 -32, 152 -32, 152 -34, 150 -34))', 4326)) = 1;

 

Statement 'select shape from gpspoint where shape.ST_Intersects(ST_GeomFromWKT('Polygon((150 -34, 150 -32, 152 ...'

successfully executed in 1:15.091 minutes  (server processing time: 1:15.076 minutes)

Fetched 1000 row(s) in 40 ms 349 µs (server processing time: 6 ms 843 µs)

Result limited to 1000 row(s) due to value configured in the Preferences

 

When I add an extra restriction, it is quick.

 

select shape

from gpspoint

where shape.ST_Intersects(ST_GeomFromWKT('Polygon((150 -34, 150 -32, 152 -32, 152 -34, 150 -34))', 4326)) = 1

AND status = 'Unavailable';

 

Statement 'select shape from gpspoint where shape.ST_Intersects(ST_GeomFromWKT('Polygon((150 -34, 150 -32, 152 ...'

successfully executed in 5.009 seconds  (server processing time: 4.991 seconds)

Fetched 1000 row(s) in 39 ms 241 µs (server processing time: 7 ms 323 µs)

Result limited to 1000 row(s) due to value configured in the Preferences

 

And when I query all rows it is very fast as well.

 

select shape from gpspoint;

 

Statement 'select shape from gpspoint'

successfully executed in 96 ms 588 µs  (server processing time: 82 ms 271 µs)

Fetched 1000 row(s) in 41 ms 695 µs (server processing time: 9 ms 412 µs)

Result limited to 1000 row(s) due to value configured in the Preferences

 

Is this expected behaviour?

Any idea how we can improve things?

 

Regards,

 

Patrick


Viewing all articles
Browse latest Browse all 9165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>