With complex data, comes complex mechanisms to handle it. What if we had a catalyst that will increase the pace of handling data? That is what Big Objects from Salesforce does.
What Are Big Objects?
Big Objects are objects that help you store and manage massive amount of data on Salesforce Platform. Big objects capture data via a standard set of APIs to clients and external systems.
Big Objects differentiates itself from other objects by its unique feature in providing consistent performance on records, even if there are a billion of them.
Big Objects are of two types:
- Standard big objects
- Custom big objects
Standard big objects are objects that are defined by Salesforce. Standard Big Objects are included in Salesforce products. FieldHistoryArchive is a standard big object that stores Field Audit Trail product data.
Custom big objects are new objects that you create to store information unique to your org. Custom big objects extend the functionality that Lightning Platform provides.
Use Cases of Custom Big Object
Before discussing about the creation of big objects, let’s us have a quick summary on some of the use cases that Big objects work with. The below mentioned are some of the Salesforce defined Standard Big Object Functionalities.
Enhance Customer 360
A 360° view of the customer can help your Salesforce data model to be extended by including more detailed information from loyalty programs, e-commerce transactions, billing and provisioning information, and more.
Auditing and tracking
Auditing and tracking will unlock the feature of maintaining your user’s usage of Salesforce or, in other words, of your customer’s usage of your products. This will be a long-term view of your customer activities. Auditing and tracking helps you for analysis or compliance purposes
Historical archive helps in optimizing the performance of your core CRM or Lightning applications. It also helps in maintaining access to historical data.
Unique identifier for the records in Big Objects
Defining an index is compulsory in order to uniquely identify the Big Object records. It is mandatory to define an index from API 40.0. Upto 5 fields can be compounded in this index.
- Insertion is similar to Upsertion when using Big Objects. If you try to insert a record which already has an index in the database, the existing record will be updated, instead of a new one being created
- Any kind of filtering /ordering is not possible in Big Objects. You can use order by/ filter by only on the fields specified in the index.
- Index fields cannot be changed once the Big Objects are deployed.
Define and Deploy Custom Big Objects
A custom Big object can be defined using Metadata API. XML files containing definition, fields and index need to be created.
- First we create an object file to define the custom big objects, its fields and its index. While creating the object file make sure that the deployment status is set to deployed.
- Secondly we create a permissionset / profile file. By default, access to custom big objects is restricted. So we create this file to specify permissions for specific fields. This file is not mandatory, but is required to grant access permissions.
Finally create package file for the metadata package to specify the contents.
To deploy a custom big object, we can use different migration tools like Workbench or the Ant Migration Tool. Create a folder containing all the above mentioned file naming “objects” for object file, “permissionsets” for permissionset file. Package.xml must be in the root directory. Once the custom object is deployed, you can view it in Setup->Big Objects in your organization.
Querying Big Objects
Big Objects can be queried either using standard SOQL or by Async SOQL.
Standard SOQL can be used for retrieving small amount of data. A subset of standard SOQL can be used for querying Big Objects.
To retrieve millions and millions of potential records from custom Big Objects, Async SOQL can be used. It can run queries that normally time out with regular SOQL. Multiple queries can run in the background and updation of completion status can be monitored. Async SOQL is the best way to query huge amount of data.
Things to Keep in Mind
- Big Objects support only object and field level permissions. This comes into consideration if there is sharing restrictions based on roles around the object data.
- You cannot define or add a field to a custom Big Object through UI. To achieve this, you must use the Metadata API
- The number of Big Objects is limited to 100, which is similar to limits on custom objects.
- Features like triggers, flows, processes, and the Salesforce app are not available on Big Objects to support the scale of data
In general, developers need data for creating apps, but the volume of data is always a problem that they face. Big Objects help you deal with huge amount of records and run queries designed for consistent performance at scale. It enables the Big Data capability to the Salesforce platform. Big Objects helps you to manage data with the same Salesforce platform tools and APIs you know. Want assistance? Get in touch with our expertise.