Loading

Know the difference between the LastModifiedDate and SystemModStamp

Publiseringsdato: Jun 25, 2026
Beskrivelse

SystemModStamp and LastModifiedDate are system fields with similar behavior, but slightly different properties. To help your application scale and perform with large data volumes, it is important to understand the performance implications of choosing one field over the other when using them in SOQL filters.

Løsning

What Is the Difference Between LastModifiedDate and SystemModStamp?
Both LastModifiedDate and SystemModStamp are system fields that store date and time values for each record.

  • LastModifiedDate is automatically updated whenever a user creates or updates a record. It can be set to a back-dated value to preserve original timestamps when migrating data into Salesforce.

  • SystemModStamp is strictly read-only. It is updated not only when a user updates the record, but also when automated system processes (such as triggers and workflow actions) update the record. As a result, it is always true that LastModifiedDate is less than or equal to SystemModStamp, but never greater.

How LastModifiedDate Filters Affect SOQL Performance
Under the hood, SystemModStamp is indexed, but LastModifiedDate is not. The Salesforce query optimizer will intelligently attempt to use the index on SystemModStamp even when a SOQL query filters on LastModifiedDate.
However, the query optimizer cannot use the index if the SOQL query uses LastModifiedDate to define the upper boundary of a date range. This is because SystemModStamp can be greater than LastModifiedDate, and using the index could cause records in that gap to be missed.
For example, the following query performs well because the optimizer can use the SystemModStamp index: SELECT Id, Name FROM Account WHERE LastModifiedDate > 2014-11-08T00:00:00Z
The following query cannot be optimized because it defines an upper boundary using LastModifiedDate: SELECT Id, Name FROM Account WHERE LastModifiedDate < CutoffDate__c

Options to Optimize Performance for LastModifiedDate
The simplest solution is to use SystemModStamp instead of LastModifiedDate in your SOQL filters. If your business requirements prevent this, consider these alternatives:

  • Use a custom date field: Use workflow field updates or triggers to copy the LastModifiedDate value into a custom field, then contact Support to request a custom index on that field.
  • Add a skinny table: For large data volumes, a skinny table includes an indexed LastModifiedDate by default. Contact Support to request this.
  • Filter on LastActivityDate: If you are filtering Account or Contact records by activity, request an index on LastActivityDate from Support.
  • Use the Data Replication API: The getUpdated() API method uses SystemModStamp internally to identify matching records, falling back to LastModifiedDate or CreatedDate if SystemModStamp is not available.

 

Knowledge-artikkelnummer

000386977

 
Laster
Salesforce Help | Article