Eagerly Loaded Describe SObject Result

Impact area

Performance

Severity

Medium

Affected element

Apex Class

Rule ID

SF-EAGERLY-SOBJECT

Impact

When using SObjectType.getDescribe() or Schema.describeSObjects() without supplying a SObjectDescribeOptions, implicitly it will be using SObjectDescribeOptions.DEFAULT and then all child relationships will be loaded eagerly regardless whether this information is needed or not. This has a potential negative performance impact. 

Remediation

Instead SObjectType.getDescribe(options) or Schema.describeSObjects(SObjectTypes, options) should be used and a SObjectDescribeOptions should be supplied.

Time to fix

30 min

References

This rule is linked to EagerlyLoadedDescribeSObjectResult

What's here


Related content

Apex Page rules

Salesforce rules




Last modified on Oct 3, 2023