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

441
3
09-04-2017 02:19 AM
KevinHaeni
New Contributor III

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?

0 Kudos
3 Replies
RebeccaStrauch__GISP
MVP Esteemed Contributor

Kevin, I converted this from a discussion to a question. Also, tagging https://community.esri.com/community/developers/web-developers/arcgis-api-for-javascript?sr=search&s...‌ for more exposure.

it may help to know what version of ArcGIS Server you are using, and if you recently upgraded, from what to what?

0 Kudos
KevinHaeni
New Contributor III

Hi Rebecca

Thank you! It seems we have version 10.4.1 installed!

0 Kudos
KevinHaeni
New Contributor III

Ah and we haven't upgraded the server so far.

0 Kudos