Get Started with Big Objects
Learning Objectives
After completing this unit, you’ll be able to:
- Describe what big objects are.
- Identify common use cases for custom big objects.
- Identify ways to query big objects.
What Are Big Objects?
You, the consummate Salesforce pro, know all about standard objects, custom objects, and external objects. You know all about how these objects help you manage and manipulate data so you can do amazing trailblazing things with your org or external system.
In this bold new era of big data, you can often find yourself with a bit too much data, a victim of your own success. There are numbers to crunch, but it’s hard to effectively or efficiently crunch them. Performance takes a hit, and you start to wish that your standard, custom, or external objects could be… bigger.
That’s where big objects come in. Big objects allow you to store and manage a massive amount of data on the Salesforce platform. How massive, you ask?
A thousand records? No, think bigger.
A hundred thousand? Bigger!
A million? Not even close!
Big objects provide consistent performance for a billion records or more, and are accessible with a standard set of APIs to your org or external system. Think of all that data! We basically took a gigant-o-ray to the objects you already know and love to create big objects.
There are two flavors of big objects.
Standard big objects are defined by Salesforce and are included in Salesforce products. FieldHistoryArchive, part of our Field Audit Trail product, is an example of a standard big object. FieldHistoryArchive allows you to store up to 10 years’ worth of archived field history data, helping you comply with industry regulations related to auditing and data retention.
Custom big objects are defined and deployed in Setup. You can create a custom big object in Setup, where you set its definition, fields, and index. The fields defined in a big object’s index determine the big object’s identity and its ability to be queried. We get into how this is all put together in the next unit.
What Are Some Ways I Can Use Custom Big Objects?
Although you can use big objects to store different kinds of data, big objects were created to tackle a few specific scenarios.
360° View of the Customer
You’ve got a lot of customer information you want to store. From loyalty programs to transactions, order, and billing information, use a custom big object to keep track of every detail.
Auditing and Tracking
Keep a long-term view of your users’ Salesforce usage for analysis or compliance purposes.
Historical Archive
Maintain access to historical data for analysis or compliance purposes while optimizing the performance of your core CRM or Lightning Platform applications.
Querying Big Objects
Of course, keeping all that data won’t do you any good if you can’t run the proper analytics on your records. You can query big objects using standard SOQL with the Bulk API and batch Apex. If you’re used to working with Salesforce data, Bulk API and batch Apex are familiar to you. We go deeper into how standard SOQL works differently with big objects in the next unit.
Bulk API can query results larger than 100k records, which is optimal for reporting. If you need to manipulate data, batch Apex is a better option. Salesforce recommends that you structure your Batch Apex job so that it self-paginates if you want to operate on result sets larger than 50k. If you need additional processing, you can also trigger additional Apex Batch jobs in the finish()
call.
What’s the Catch?
Because of the scale that big objects operate in, they don’t work exactly like non-big objects. Here are some things to keep in mind when using big objects.
- Big objects support only object and field permissions.
- Once you’ve deployed a big object, you can’t edit or delete the index. To change the index, start over with a new big object.
- SOQL relationship queries are based on a lookup field from a big object to a standard or custom object in the select field list (not in filters or subqueries).
- Big objects support custom Salesforce Lightning and Visualforce components rather than standard UI elements (home pages, detail pages, list views, and so on).
- You can create up to 100 big objects per org. The limits for big object fields are similar to the limits on custom objects, and depend on your org’s license type.
- Big objects don’t support transactions that include big objects, standard objects, and custom objects.
- To support the scale of data in a big object, you can’t use triggers, flows, processes, and the Salesforce app.
Resources