Designing a Salesforce Data Model That Scales

The decisions that matter most in a Salesforce data model: grain, ownership, relationship types, data skew and volume, plus a review process to follow before you build.

Type
Article
Topic
CRM & Engineering
Reading time
6 min
Updated
Author
GeekMidst Team
Reviewed by
Site owner
Banner for the GeekMidst article “Designing a Salesforce Data Model That Scales”, covering Start from the business questions, not the screens and…

Most Salesforce data model problems are invisible on day one. They show up two years later as record locking errors during data loads, reports that time out, sharing recalculations that run for hours, or a custom object nobody dares to change because twelve integrations write to it. Designing a Salesforce data model that scales means making a handful of decisions deliberately at the start, and writing them down.

Checklist of six data model review steps: entities and grain, ownership and sharing, volumes, keys and sources, reporting needs and integration and security review
Agree grain, ownership, volumes and keys before building in Setup, and record each decision in the data dictionary. View full size

Start from the business questions, not the screens

Before creating any object, list the questions the business needs to answer and the processes that create data. "Which accounts renewed late last quarter?" tells you that renewals are records with dates, not a checkbox on Account. Then decide, for each entity:

  • Grain. What does one record represent? An order or an order line? A subscription or a subscription period? Getting grain wrong is the most expensive mistake to undo.
  • Ownership and visibility. Who owns these records and who needs to see them? This drives the choice between lookup and master-detail more than anything else.
  • Volume and growth. Roughly how many records now, and in three years? Ten thousand and ten million need different designs.
  • Source of truth. Is Salesforce the system of record, or a copy of data mastered elsewhere? Copies need an external ID and a clear sync direction.

Prefer standard objects where they genuinely fit

Standard objects such as Account, Contact, Opportunity, Case, Product and Order come with built-in behaviour, reporting and integration support that you would otherwise rebuild. Use them when the meaning matches. Do not force a concept into a standard object just to avoid a custom one: a site visit stored as a Task with ten custom fields is harder to report on and secure than a small custom object.

Choose relationships on purpose

Relationship type decides delete behaviour, sharing, roll-ups and locking. The table summarises the trade-offs.

Relationship types compared

LookupMaster-detailJunction object
Parent requiredOptional by defaultAlwaysBoth parents required
Deleting the parentConfigurable; child is usually keptChildren are deleted tooJunction records are deleted with either parent
Sharing and ownershipChild has its own ownerChild inherits from the parentAccess depends on both parents
Roll-up summary fieldsNot available nativelyAvailableAvailable on both parents
Best forOptional or loose linksRecords that cannot exist without the parentMany-to-many relationships

Master-detail is attractive because of roll-up summaries, but child records inherit sharing from the parent and saving a child can lock the parent. If a parent will accumulate a very large number of children, or the children need their own owner, a lookup with Flow or Apex maintaining any summaries may scale better.

Watch for data skew

Data skew is when too many child records point at one parent, or one user owns too many records. Salesforce guidance commonly uses around 10,000 child records per parent as the point where skew starts to cause trouble. Typical symptoms are UNABLE_TO_LOCK_ROW errors during bulk loads and slow sharing recalculation after ownership or role changes.

Common causes are a catch-all "Unknown" account that collects orphaned contacts, an integration user that owns every record, and lookups to a single placeholder record. Fix the design rather than the symptom: distribute records across real parents, assign ownership meaningfully and avoid placeholder parents.

You can spot account skew with an aggregate query like the one below. On very large objects it may time out, so run it in a full sandbox or against an extract.

soql
SELECT AccountId, COUNT(Id) contactCount
FROM Contact
WHERE AccountId != null
GROUP BY AccountId
HAVING COUNT(Id) > 10000
ORDER BY COUNT(Id) DESC
LIMIT 50
Finds accounts with more than 10,000 contacts. Swap the object and lookup field to check other relationships.

Design for large data volumes early

When an object will hold millions of rows, query selectivity matters. Filters on indexed fields, such as Id, Name, OwnerId, lookup fields, external IDs and unique fields, let the query optimiser avoid full scans. Mark integration keys as External ID so upserts and filters use an index. Avoid leading wildcards in LIKE filters and filtering on formula fields in high-volume queries. For data that must be kept but is rarely used, plan archiving from the start, whether into Big Objects, an external store or a data platform. Thresholds and indexing options change over time, so check current large data volume guidance in Salesforce Help.

Keep the model understandable

Scale is also about people. A model that only its original builder understands does not scale to a team.

  • Give every custom object and field a description and help text that explains what it means, not what type it is.
  • Use consistent API names and avoid suffixes like Status2__c.
  • Use record types for genuinely different processes on the same entity, not for every layout variation.
  • Use picklists for short, stable value lists and a reference object for lists that change often or carry their own attributes.
  • Keep a data dictionary and update it whenever fields change.

A design review before you build

  1. 01

    Map entities and grain

    List each entity, what one record represents and the process that creates it. Agree this with the business before anything is built in Setup.

  2. 02

    Assign ownership and sharing

    Decide who owns each object and its org-wide default. For most relationships this settles lookup versus master-detail.

  3. 03

    Estimate volumes

    Record current counts and three-year growth per object, and flag anything likely to reach millions of rows or create skew.

  4. 04

    Define keys and sources

    Name the system of record and the external ID for every object fed by an integration, and the direction of sync.

  5. 05

    Check reporting needs

    Confirm that key reports can be built from the proposed relationships without duplicated data or awkward report types.

  6. 06

    Review with integration and security owners

    Walk through the model with whoever owns integrations and data protection, then record the decisions in the dictionary.

Questions we hear

Should we use one object with record types or several objects?
If the records share most fields, the same ownership model and the same reporting needs, one object with record types is simpler. If they have different security requirements or very different fields, separate objects are usually cleaner.
Can we change a lookup to master-detail later?
Often yes, but every existing child record needs a parent value first, and the change alters sharing and delete behaviour. Rehearse it in a full sandbox with production-like data.
How many custom fields is too many on one object?
Hard limits depend on edition, so check current limits for your org in Salesforce Help. Long before the limit, very wide objects become hard to maintain, which usually means one object is holding more than one concept.
When should data live outside Salesforce?
High-volume, rarely edited data such as raw event logs or historic transactions is often better kept in a data platform and surfaced as summaries, external objects or through Data Cloud.

Review your data model before it hardens

We can review an existing or proposed data model for skew, sharing and volume risks, and give you written recommendations with the trade-offs explained.

Request an architecture review →

Tell us what you are trying to fix.

Share your Salesforce setup, goals and constraints. A practitioner reads every message and replies with questions, first thoughts or an honest view of whether you need outside help at all.

Talk to a Salesforce Expert
Book a Consultation