Newer Version Available
QueryLocator
When results for a large or complex query can’t be returned in a single batch, one or more server-side cursors and corresponding query locators are automatically created. A cursor marks the location of additional query results in the database, and a query locator finds the cursor.
A new queryLocator is returned in the QueryResult object when there are more records than can be returned by a query() or queryMore() call. To get the next set of results, follow up with a subsequent queryMore() call using the most recently returned query locator value. Use each queryLocator value only one time.
You can't use queryLocator with queries that access a custom metadata type.
For invalid query locators, the API returns the fault element InvalidQueryLocatorFault and a possible extended error code with additional information.