Print this page

How to improve "Inefficient Related Lists"

Knowledge Article Number 000206401
Description If you have detail pages that have a large number of related list records, you might be experiencing page load performance and usability issues. Read this article for suggestions on how to improve your pages and provide the right kind of related list information. 

A well-designed page in Salesforce provides just the right amount of information your users need. If you provide insufficient detail information your users have to navigate through multiple pages in their work process, which slows them down. Provide too much information, however, and your users have to parse information not relevant to their needs. Additionally, too much information means poor page performance as Salesforce gathers and renders all the necessary information for the page.

Inefficient use of related lists on detail pages is one common example where your pages might be providing too much information. The following example shows an Account with related lists for Contacts, Opportunities and Cases, and a related list for a custom RelatedListTestObjects object:
Large detail page with many related list items

As the number of related records grows, this page will grow, which will necessitate scrolling through more and more information to find what the user wants. Also, more related records will incur more of a performance overhead as Salesforce fetches all the necessary related record info.

This article provides some suggestions on how to improve your page performance and page design by understanding how related lists are used, and how they’re presented.


Reduce the Number of Related Records


A general rule of thumb is that 10,000 or more related records will cause significant performance problems and possible related list load errors. However, even 1,000 related records in a single related list will not be easy for a user to interact with. If your users are seeing thousands of related records in their related lists and aren’t expecting this, you might have issues with data quality. There might be duplicate or otherwise redundant data, or data that wasn’t properly deleted or updated. Removing these records (see also Empty the Recycle Bin below) will improve performance and usability.

To determine if you have incorrect data, you can do some analysis on your data for the related objects. If users are reporting seeing related records that they believe should have been deleted or otherwise disassociated, this might suggest some data operations were not completed successfully. See 6 Steps Towards Top Data Quality for some general suggestions on keeping your data clean.

Large amounts of records related to a single parent record might also be a sign of bad data skew. See the following articles for ways to re-architect your data to avoid data skew:

Avoid Account Data Skew for Peak Performance
Architect Salesforce Record Ownership Skew for Peak Performance in Large Data Volume Environments
Reducing Lock Contention by Avoiding Account Data Skew


Reduce the Number of Related Lists


While it may be tempting to include lists of all related records on a page via related lists, users usually don’t need to see all the related records to get the information they want.

You can improve the usability and performance of your page by removing unneeded related lists from the page layout, and controlling which layouts apply for specific user profiles. Page layouts can be defined for specific user profiles, so you can modify page layouts to show only the related list that a particular user profile needs. For example, if the Marketing user profile doesn’t need to see all Cases associated with an Account, you could remove that related list from the Marketing profile Account page layout. Work with your users to determine which related lists are truly needed, and which lists can be omitted.

See the following information on removing related lists from page layouts:

“Related Lists” section of Enhanced Page Layout Editor User Interface Elements

See the following information on assigning page layouts to specific user profiles:

Assigning Page Layouts in the Original Profile User Interface
Assigning Record Types and Page Layouts in the Enhanced Profile User Interface

See the following articles for more information on additional ways to refine what related list information is shown on your pages:

Less is More: Visualforce Page Usability and Performance
Performance Tuning Tips for Related Lists in Account


Refine the Fields Shown for Related Lists


Users might not need all the fields shown for related lists. You can remove unneeded fields by editing the page layout. In the above example, maybe a contact’s title field doesn’t need to be displayed in the related list information. See Customizing Related Lists for how to edit which fields are shown for a related list.

While removing fields, you can also configure which field is used to sort the related list in the page layout related list properties. Picking a field that is indexed will improve performance when Salesforce retrieves related record information. However, note that a user can configure their own preference of which field to sort the related list against. For details on which standard fields are indexed, see the Query & Search Optimization Cheat Sheet.

You can survey your users to determine which fields are required and which can be removed. Performance Tuning Tips for Related Lists in Account provides some additional details on removing unneeded related list fields.


Reduce the Number of Related Records Shown


Users can control how many related records are shown by default via the “Always show fewer/more records per related list” setting at the bottom of a detail page. Note that this setting applies to all record pages by default, so if a user adjusted this setting by mistake when they only wanted to see more related records for a particular object, they may be seeing too much information on other object pages.

Note that reducing the number of related records shown per list may encourage users to customize how the list is sorted (to show records most relevant earlier in the list). If users are configuring the sort field, you might be able to pick an indexed sort field that works for everyone in the page layout related list properties. Picking a field that is indexed will improve performance when Salesforce retrieves related record information.

See How to show more/fewer records per related list - Default User Setting? for more details on the “fewer/more records” setting.


Use a Custom Link instead of a Related List


If you remove a related list from a layout but still want to let the user navigate to a related list of records, you can add a custom link to the page layout that goes to a custom report of related records. See Defining Custom Buttons and Links and Custom Button and Link Samples for more details.

Using the previous example, you could replace the Cases related list with a custom link, that would look something like this on the Account page layout:

Custom link detail page example


Defer Loading of Related List Records


You can configure Salesforce to load related lists asynchronously, instead of immediately when a page is viewed. This can provide a small page load performance gain without changing the current user experience. Under Setup, App Setup, Customize, User Interface, enable the “Enable Separate Loading of Related Lists” setting.

Note that this change merely defers the data load, so if there are still hundreds of thousands of related records, the asynchronous load might still perform poorly or even fail.

See more details on the “Enable Separate Loading of Related Lists” setting in Customizing User Interface Settings.


Replace Related Lists with Visualforce


If the related list information is frequently updated and users need all the related list information on the page, consider replacing the related lists with custom Visualforce components. With a small amount of development work, you can create Visualforce that lets you fully customize what related information is retrieved, and how that information is displayed.

As a very simple example, you could use Visualforce to display the related information on separate tabs on the page, rather than have everything on a single page. The example Account page used earlier could be modified to look something like this:
Visualforce page with tabbed related lists

This approach is described in detail in Overridding an Existing Page with a Visualforce Page. Note that you can even control deferred loading of a tab’s contents via the switchType attribute of a tab panel.

More sophisticated Visualforce related list replacements could utilize SOQL in the controller to apply query filters and use the SOQL LIMIT clause to limit the number of related records retrieved.

For more information on replacing related lists with Visualforce, see the following:


Customizing Related Lists Using Visualforce and Apex
Visualforce Example Using a Related List
Visualforce Performance: Best Practices


Empty the Recycle Bin


Even though deleted records will not show up in related lists, there can still be a performance impact if related records are in the recycle bin. When Salesforce retrieves the records to be displayed in a related list, it has to consider and filter out records in the recycle bin. Also, even after the recycle bin has been emptied, records may still impact performance until they are fully deleted by the physical delete process. If you are doing mass deletes of related records, make sure to both empty your recycle bin and schedule a physical delete sweep with Salesforce support.

See Using the Recycle Bin for more information on emptying the recycle bin. If you are doing mass deletes of custom objects, see also Truncating Custom Objects.


promote demote