Reports and Dashboards are used to visualize the company’s key performance indicators in graphical and tabular formats. Salesforce Dashboards provide real-time statistics of the company. With large data over time reports and dashboards start performing slowly. Sometimes few reports are so slow that it takes more than 2 hrs to render them. We have to optimize these low-performing reports to make them faster. This post will provide different ways to optimize Salesforce Reports and Dashboard.
- Use Index and Custom Index
- Use Proper Date Filter
- Remove Unwanted Fields from Reports
- Divide Reports
- Use Skinny Table
- Use Scheduled Report
- Clear Recycle Bin
- Selective Query in Custom Report
- Make Source Report Faster
- Split Dashboard Component
Let us see all the above improvement topics in detail.
1. Use Index and Custom Index
When we have huge data in an object and we are loading a report created on that object, it might take time to load. This can be due to the lack of an index column in the report filter. We can use any index columns (Id, audit fields, external id, record type id, lookup columns, etc) in filter criteria.
If we can leverage any of the above-mentioned fields it will make our query faster. Even after using the standard index, if reports are not loading faster, then we should consider for custom index. We should approach Salesforce for a custom index with business justification.
2. Use the Proper Filter
Sometimes loading a wide range of data takes a huge time. In such a situation, we should consider retrieving less range of data. Let us take an example, if we are generating transactional data reports without any filter or data from many years, it will take time. It will be better to create a report which will generate reports of the last 1-2 years instead of 5-10 years.
We should always use EQUALS instead of CONTAINS. EQUALS execute in fewer steps. CONTAINS executes a filter for each character which takes multiple trips for querying data.
We should not use a filter with DOES NOT CONTAIN in the report. It evaluates the filter for each character that takes many steps to return data, which slows down the report. NOT EQUAL TO execute in fewer steps, resulting in a faster report.
3. Remove Unwanted Fields from Reports
We create custom report types and we add a lot of fields to that report type considering it can be used later. These unwanted columns will take extra time to load while loading the report.
These extra columns will also create a loading issue while grouping information in the summary and metrics report. It will be better to include only those fields which are required in the report/custom report type.
4. Divide Reports
Instead of generating reports of a wide range of data, better will be reduced result data and generate reports with fewer data sets. Instead of showing account reports of all data, create multiple reports with different regions, different departments, or different countries. This way data will be less and it will load reports faster.
5. Use Skinny Table
If the above-mentioned tips are not working then we can use a skinny table to create the report. Skinny tables are tables that have combined fields from two related objects which are used in report creation. Using a skinny table we don’t need to join two or multiple objects. We simply use one single skinny table that has only required fields from objects. This way no join query is required and it will make the query faster to load on the report.
Check out the post for more detail about the skinny tables.
6. Use Scheduled Report
If we want a report for a wide range of data then we can consider the scheduled report. We can schedule reports when our org is not busy with a lot of transactional operations or background jobs. This way users will get the report directly in their email inbox without the need to login into Salesforce Org.
7. Clear Recycle Bin
When we delete records, they will still be available in recycle bin for 15 days. When we load the report those deleted reports will also be queried which might impact performance. So better remove those deleted records from recycle bin as well.
8. Selective Query in Custom Report
We create custom reports using the Visual Force page and lightning components when the standard report is not sufficient for our use case. We should make our query selective for the custom reports so that it will load data faster. To learn about selective queries check Optimize SOQL Filter in Apex Code.
9. Make Source Report Faster
The best way to speed up a slow dashboard is to speed up its source reports. If reports will run faster dashboard will run fast. The above-mentioned technique will help in speeding up reports.
10. Split Dashboard Component
If we have a dashboard with multiple components that takes a long time to refresh then we should split the dashboard into two. This way dashboard component will load faster.