gost / server

GOST - Go implementation of OGC SensorThings API
MIT License
61 stars 19 forks source link

GET Datastream(id) slow on large database #174

Open tebben opened 4 years ago

tebben commented 4 years ago

GET v1.0/Datastreams(id) response can be slow or even return a timeout on a larger database. This problem occurs on our test server with around 25m observations.

The slow performance is caused by postgis/datastream.go GetObservedArea()

select ST_AsGeoJSON(ST_ConvexHull(ST_Collect(feature))) as geom from %s.featureofinterest where id in (select distinct featureofinterest_id from %s.observation where stream_id=%v)