Query Plan
SOQL Query Plan is a Salesforce feature that helps developers and administrators understand how their SOQL queries are executed by the Salesforce database engine. It provides insights into the performance of queries and helps identify potential bottlenecks or inefficiencies.
Brobench provides a way to analyze the query plan of SOQL queries and visualize the Salesforce response.
There are two ways to view the Query Plan of a SOQL query
- While you are in the Query Editor, select the Query you want to analyze and click on the
Execute Other
button and select theView Query Plan
option.
- Once you have executed a query, you can view the Query Plan of that query by clicking on the
More Actions
menu in the Query Datagrid and select theView Query Plan
option.
Once you select the View Query Plan
option, Brobench will display the Query Plan dialog with plan details as shown
below.
Understanding the Query Plan
Here are the various fields and what they mean from here.
Cardinality | Fields | Leading Operation Type | Cost | sObject Cardinality | sObject Type |
---|---|---|---|---|---|
The estimated number of records that the leading operation type would return. For example, the number of records returned if using an index table. | The indexed field(s) used by the Query Optimizer. If the leading operation type is Index, the fields value is Index. Otherwise, the fields value is null. | The primary operation type that Salesforce will use to optimize the query.
| The cost of the query compared to the Force.com Query Optimizer’s selectivity threshold. Values above 1 mean that the query won’t be selective. | The approximate record count for the queried object. | The name of the queried. |
Resources
Here are additional resources you may find helpful to understand and optimize your SOQL queries