A simple helper class that can be used to identify the three different types of skew.
- Account Data Skew
- Ownership Skew
- Lookup Skew
Find accounts that have the most contacts, opportunities and cases.
List<AggregateResult> accs1 = Skew_Helper.getAccountsWithTheMostContacts();
List<AggregateResult> accs2 = Skew_Helper.getAccountsWithTheMostOpportunities();
List<AggregateResult> accs3 = Skew_Helper.getAccountsWithTheMostCases();
Find users that own the most records of a particular object (either standard or custom).
List<AggregateResult> users = Skew_Helper.getTopOwnersForSObject('Account');
Find records that have the most lookup relationships to another object.
List<AggregateResult> cons = Skew_Helper.getTopRelationshipsForRelatedSObject('Contact', 'Account.Id');