Large queries and server limits

7775
6
06-01-2012 10:08 AM
MostafaAsadi
New Contributor
Hi,

The GIS server can be configured to limited the number of returned results in a REST query call (max is apparently 2000 records). With this limitation in place, how do you query for all the records? Any ideas on what would be the best practice?

Thanks!
0 Kudos
6 Replies
nicogis
MVP Frequent Contributor
...ArcGIS Server map services limit the number of records that can be returned by a query to 1,000 by default. Keep this value or lower it for best performance with queries. You can change the number of allowable result records by editing the MaxRecordCount property in the map service configuration file.
Use caution if you raise the default value. Queries that return more than 2,000 records require the software to create scratch workspaces in your system TEMP directory to manage the result records. This can cause performance to degrade...
MostafaAsadi
New Contributor
That is actually my question: how do I query for *everything*? Obviously I need to call the REST service multiple times but how do I do incremental queries?

Thanks.
0 Kudos
nicogis
MVP Frequent Contributor
you can use returnIdsOnly
"...Note that while there is a limit on the number of features included in the feature set response, there is no limit on the number of object IDs returned in the ID array response. Clients can exploit this to get all the query conforming object IDs by specifying returnIdsOnly=true and subsequently requesting feature sets for subsets of object IDs. ..."
0 Kudos
MostafaAsadi
New Contributor
Thanks! That can be very helpful! I'll look into it.
0 Kudos
MostafaAsadi
New Contributor
Thanks! That can be very helpful! I'll look into it.

A related question: how are the results sorted if I want to order by some field and the resultset is larger than 1000 records? Does the server *first* sorts all records, then returns me the first chunk of 1000 records? Or, does it first grab some 1000 records and *then* sorts them?

Thanks!
0 Kudos
nicogis
MVP Frequent Contributor
in rest 10.1 you have orderByFields ( http://servicesbeta2.esri.com/arcgis/sdk/rest/query.html ) so you can order for your fields. I haven't tried but oids should be in order of result of query.
0 Kudos