13.07.2015 Views

Database.com REST API Developer's Guide - Salesforce.com

Database.com REST API Developer's Guide - Salesforce.com

Database.com REST API Developer's Guide - Salesforce.com

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Using <strong>REST</strong> <strong>API</strong> ResourcesGet Feedback on Query PerformanceRetrieving the Remaining SOQL Query ResultsIf the initial query returns only part of the results, the end of the response will contain a field called nextRecordsUrl. Forexample, you might find this attribute at the end of your query:"nextRecordsUrl" : "/services/data/v29.0/query/01gD0000002HU6KIAW-2000"In such cases, request the next batch of records and repeat until all records have been retrieved. These requests usenextRecordsUrl, and do not include any parameters.Note that even though nextRecordsUrl has query in the URL, it will still provide remaining results from the initialQueryAll request. The remaining results will include deleted records that matched the initial query.Example usage for retrieving the remaining results/services/data/v29.0/query/01gD0000002HU6KIAW-2000Example request body for retrieving the remaining resultsnone requiredExample response body for retrieving the remaining results{}"done" : true,"totalSize" : 3214,"records" : [...]Get Feedback on Query PerformanceNote: Using explain with the <strong>REST</strong> <strong>API</strong> query resource is a pilot feature. There is no support associated with thispilot feature. For more information, contact salesforce.<strong>com</strong>, inc.Use the Query resource along with the explain parameter to get feedback on how <strong>Database</strong>.<strong>com</strong> will execute your query.<strong>Database</strong>.<strong>com</strong> analyzes each query to find the optimal approach to obtain the query results. Depending on the query and queryfilters, an index or internal optimization might get used. You use the explain parameter to return details on how <strong>Database</strong>.<strong>com</strong>will optimize your query, without actually running the query. Based on the response, you can decide whether to fine-tune theperformance of your query by making changes like adding filters to make the query more selective.The response will contain one or more query execution plans that, sorted from most optimal to least optimal. The most optimalplan is the plan that’s used when the query is executed.See the explain parameter in Query for more details on the fields returned when using explain. See “More EfficientSOQL Queries” in the Apex Code Developer’s <strong>Guide</strong> for more information on making your queries more selective.Example usage for getting performance feedback on a query that uses Merchandise__c/services/data/v30.0/query/?explain=SELECT+Name+FROM+Merchandise__c+WHERE+CreatedDate+=+TODAY+AND+Price__c+>+10.0Example response body for executing a performance feedback query{"plans" : [ {44

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!