Improve SOQL Performance SOQL (Salesforce Object Query Language) used to search Salesforce data for specific information. SOQL allows us to specify source object, a list of fields to retrieve and condition for selecting rows in source object. SOQL returns List<Sobject> To avoid long execution time, non-selective SOQL queries may be terminated by the system to improve the performance. A query is selective when one of the query filters is on an indexed field and query filter reduces the resulting number of rows below a system-defined threshold. The performance of the SOQL query improves when two or more filters used in the WHERE clause meet the mentioned conditions. Following fields are indexed by default and when used in SOQL WHERE clause improved the permormance. Primary Key (Id, Name and Owner fields) Foreign Keys ( lookup or master-detail relationship fields). Audit dates ( systemModStamp). Custom fields marked as External ID or Unique. NOTE: ...
Posts
Showing posts from February, 2018
- Get link
- X
- Other Apps
By
Puneet Mishra
-
Difference between query()/ QueryMore()/ QueryAll() query(): it executes a query against the specific object and returns data that matches the specific criteria. Syntax: QueryResult = connection.query(string queryString); used in SOAP API, when a client application invokes the query() call, it passes a query string that specifies the object to query, fields to retrieve, and any condition that records need to satisfied. Client application must be logged in with sufficient access rights to query individual objects and specified fields. The query result object contains upto 500 rows of data by default. If the query results exceed 500 rows, then client application uses the queryMore() call and a server-side cursor to retrieve additional rows in 500-row chunks. queryMore(): Use this call to process query() calls that retrieve a large number of records( by default, more than 500) in the result set. The query() call retrieves the first 500 recor...