In today’s digital world, data is everywhere—created by users every second of every day. As your Salesforce org grows, so does your data. Before you know it, you're managing millions of records, thousands of users, and gigabytes of storage. Without a scalable data model, this growth can lead to performance bottlenecks, slow queries, and sandbox refresh delays.
So how do you stay ahead of the curve? It starts with smart
data modeling.
Watch Out for Data Skew
One of the biggest culprits behind poor performance in large
data volumes (LDV) is data skew—when too many child records are
linked to a single parent. Salesforce recommends keeping child records
under 10,000 per parent to avoid issues like:
- Account
Data Skew: Happens when too many contacts or opportunities are linked
to one account (e.g., an “Unassigned” account). This can cause record
locking and sharing recalculations.
- Ownership
Skew: Occurs when a single user owns a large number of records.
Sharing rule recalculations can slow down operations like deletes or
ownership changes.
- Lookup
Skew: Arises when many records reference the same lookup value. This
can lead to lock exceptions during concurrent updates, this is because you
can place lookup fields on any object in Salesforce, lookup skew can
create problems for any object within your organization.
Record Locking & Sharing Challenges
When multiple threads update records under the same parent,
Salesforce locks both the child and parent records. Even short-lived locks can
cause failures if updates overlap. Similarly, changing ownership or sharing
settings on skewed records can trigger expensive recalculations across the role
hierarchy.
External Objects: A Smarter Way to Handle LDV
Instead of storing all data in Salesforce, consider
using external objects via Salesforce Connect.
These objects map to data stored outside your org, allowing real-time access
without consuming storage. You can use external lookups and indirect
lookups to relate external data to Salesforce records—even without
Salesforce record IDs.
This approach is ideal when:
- You
only need a subset of data at a time.
- You
want to avoid syncing and storing massive datasets.
- You
need real-time access to external systems.
Best Practices for Scalable Data Models
- Distribute
child records across multiple parent records.
- Avoid
assigning thousands of records to a single user.
- Use
external objects for data you don’t need to store.
- Monitor
lookup relationships for potential skew.
- Design with sharing and locking behavior in mind.
Here’s a concise summary of the types of relationships available to external objects in Salesforce:
Relationship Type |
Allowed Child Objects |
Allowed Parent Objects |
Matching Field |
Lookup |
Standard, Custom, External |
Standard, Custom |
Salesforce 18-character Record ID |
External Lookup |
Standard, Custom, External |
External |
External ID field on the parent external object |
Indirect Lookup |
External |
Standard, Custom |
A custom field on the parent with External ID
and Unique attributes |
These relationships allow Salesforce to link external data with internal records, enabling seamless integration and real-time access without duplicating data.
No comments:
Post a Comment