AnsweredAssumed Answered

Bad count-only query performance on layer with 600'000 polygons

Question asked by kevinhaeni on Sep 4, 2017
Latest reply on Sep 4, 2017 by kevinhaeni

One of our layers contains approximately 600'000 polygons that should be displayed as a featurelayer in our application based on the 4.4 JSAPI.

 

Strangely, since the 4.3 version of the API, a count-only request to the map service is performed before it starts loading the features. It occured to me that the performance of this count-only query is very bad! It takes around 50 seconds just  to return the amount of records within that layer.

 

Further analysis with an SQL profiler has shown that a count-only query seems to be implemented in a strange way such that it translates to the following oracle / sql query:

 

select ID, spatialdata from (SQL_QUERY DEFINED IN THE MAP SERVICE / LAYER)

 

I would have expected a "select count()" here, but instead, it simply selects the ID and spatial field on the query defined in the map service, and probably counts the returned records manually. As a result, before we can load the layer, we have to wait 50 seconds just to wait for this count-query to finish.

 

Am I the only one with this problem? Is this a known bug? Is there any workaround?

Outcomes