Use Sort Criteria when Using QueryPage

If the QueryPage method is used as a stateless transaction, each request for an additional page of data returns any records that have been added or updated since the initial query. Any records that have been deleted since the first request will no longer appear in the result set.

It is recommended to use sort criteria to reduce the possibility of returning the same record when paging through results using the QueryPage method:

  • Use sort criteria on the Id field, which helps in most simple cases.

  • Use sort criteria on a field that is being filtered to help improve performance.

  • Use a stateful QueryPage Web service request, if it is required to paginate through a snapshot of data.

Note: It is however not recommended to use multiple sort criteria in a QueryPage request as it diminishes the performance of the query.