Select to view content in your preferred language

SelectFeatures query slow when using only ObjectIds param

5171
11
02-21-2013 08:20 AM
DianaBenedict
Occasional Contributor III
I have recently found that when I attempt to use the following query to selectFeatures from a FeatureLayer the response is significantly slower if I use only the query.objectIds versus the query.where.  Below are the two samples:

//The query below runs much faster when using a where clause
var selQuery = new esri.tasks.Query();
//selQuery.where = "OBJECTID = " + [addResults[0].objectId];
selQuery.objectIds = [addResults[0].objectId];

//The query below takes about 40 seconds to run when using only the objectIds.
var selQuery = new esri.tasks.Query();
//selQuery.where = "OBJECTID = " + [addResults[0].objectId];
selQuery.objectIds = [addResults[0].objectId];


Essentially, I have to call FeatureLayer.selectFeatures after a new feature is created  so that I can show the custom attribute dialog to the user. The applyEdits addResults returns only the ObjectID and GlobalId along with a success (true/false). I have been able to wire all this successfully.  I was just hoping to move away from having to deal with a where clause and string manipulation vs just using an array of objectIds.

It just seems interesting to me that the query.objectIds ONLY takes so long to return the FeatureSet.  (Note the data that I am dealing with is very large .. national scale).

Has anyone else noticed this.  ESRI, is this a known issue or am I implemting the query.objectIds incorrectly? 

Thanks
11 Replies
DerivenC
New Contributor II
I am able to reproduce this as well.  Feature layer using ArcGIS Server 10.1.  If I use an array of object IDs in the query string, it takes minutes to return.  If I use OBJECTID = ..., it is instantaneous.

The service is not mine.  So I cannot tell you what the service is connected to.  But I suspect it's linked to some other database and/or using a particular database server (Oracle?)

ESRI: if someone would like the sample REST query to test out, please let me know and I'll PM you with the urls.
0 Kudos
DianaBenedict
Occasional Contributor III
I can tell you for a fact that a COMPLETE table scan is done. I have had our DBA trace the SQL call and I am 100% sure this is occuring. Maybe it has to with the fact that our SDE data uses ST_Geometry (Oracle Database) data type but I DO NOT use objectIds though this should be a more efficient way to do this.
0 Kudos