6

Typically, each record in Salesforce will be 2kb large: https://help.salesforce.com/articleView?id=000193871&language=en_US&type=1.

However, let's say in an extreme example, the Opportunity object is related to 40 custom objects, each which has 100,000 records. The page would load much slower, especially in an older browser version.

1) Is there a 'rule of thumb' as to what the upper limit of how many related records an object should have?

2) Also, as per this link, there's an indication that there's some sort of tier-tuning per org based on the volume of data it has. Is that correct? And if so, are the volume ranges and respective tier-tuning capacity available?

  • Why do you think that having many records in a related object (not necessarily all related to the same Opportunity) will slow down the loading of any Opportunity (or any other object with relationships with other objects, for that matter)? – Derek F Jan 18 '17 at 18:30
  • Based on my own experience, the page load of a record increases with the increase of related records once it gets beyond a certain threshold. This isn't specific to the Opportunity object, I was just using that as an example. Certainly, if an Account has lots of related attachments, the page would load more slowly (the records in the related lists would take longer to render on the page) but this slowness can also be experienced with sheer volume of 2kb records. I assume the page loads slower because there is more data to query, and this is expected behaviour. – Andy Hitchings Jan 18 '17 at 18:44
  • 2
    From my understanding, the page load of a given record should take the same (or nearly the same) amount of time regardless of whether it has 10 related records (for a single sObject) or 10,000 related records. The detail page for Opportunity (or any other object) doesn't load all the related records at once, only 5 by default (in Salesforce Classic), with loading more records handled by an AJAX call.. – Derek F Jan 18 '17 at 18:46
4

For the best optimization, a Parent object should not have more than 100000 records of its child because it will slow down the process and will prevent you from deleting child records as per the official text:

Can’t I Delete a Certain Custom Object, if contains more than 100,000 records. If the object you want to delete has more than 100,000 records, first delete an appropriate number of records and then delete the object.

You will also get the Selective Query error when you will try to query parent and child records together. You will run into the issue as below:-

System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when:

    1. The filter value includes null (for instance binding with a list that contains null)
    1. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times)

Regarding the tier-tuning Salesforce only consider this:-

The selectivity threshold is 10% of the first million records and less than 5% of the records after the first million records, up to a maximum of 333,333 records. In some circumstances, for example with a query filter that is an indexed standard field, the threshold can be higher. Also, the selectivity threshold is subject to change.

Page load is affected with above things plus:-

  • No, records you are showing per related list
  • No of related list you have
  • No. of columns you have (My guess is no. of formula type columns should also affect)

Per Parent records we should not have more than 10,000 records.

As suggested by @sfdcfox:

  • You should always reference the document"Considerations for Relationships."
  • 200 child junction objects with a rollup summary to the other parent, 10,000 details in a master-detail relationship.
| improve this answer | |
  • 3
    +1 This was better than my own answer, but you should include a reference to Considerations for Relationships. – sfdcfox Jan 18 '17 at 18:55
  • 2
    Additional suggested limits: 200 child junction objects with a rollup summary to the other parent, 10,000 details in a master-detail relationship. – sfdcfox Jan 18 '17 at 18:57
  • 1
    Awesome answer, Ashwani. Also, @sfdcfox, your point about 'Enable Seperate Loading of Related Lists' in Salesforce Classic (Lightning already has this behaviour) was also helpful :) – Andy Hitchings Jan 18 '17 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.