A Salesforce big object can store millions of records on the Salesforce platform simultaneously. When we manage a large volume of data in our organization, where each object has more than 10-12k records, the system’s performance will be downgraded. In this situation, we use Salesforce big Objects.
In this Salesforce tutorial, we will learn about the Salesforce big objects where we learn to create a Salesforce Big Object.
Custom Salesforce Big Object
In Salesforce, big objects are defined as processes that permit us to store and control an enormous amount of data on the Salesforce platform. It can store millions of records on the Salesforce platform simultaneously.
It also gives compatible performance for billions or more records, and with the standard APIs, the big objects are available in our external system or our org.
There are two types of big objects in Salesforce: standard and custom.
Standard big objects: These standard objects are defined as objects involved in the Salesforce product. The standard big object involves the FirldHistoryArchive, which is also part of the Field Audit Trial Product that permits us to reserve up to 10 years of history data.
Custom big objects: A custom big object is defined as an object that can be created in a setup. This setup option is available under the gear icon, and the user can define this custom big object as per their requirements. We can execute this custom big object by using the metadata API.
Read How to Create Big Objects Custom Fields in Salesforce
Create Custom Salesforce Big Object
To create a Custom Big Object, navigate to Salesforce Lightning’s Setup page and follow the below steps.
1. On the setup page, search, then select Big Object in the Quick Find box.

2. To create a new Big Object, click on the New button in the Big Objects setup.

3. In the section Big Object Information, enter the Label and Plural Label for the Big Object.
For example, if you have entered Label as data entry then Plural Label will be data entries.

4. The Object Name will be auto-filled according to the entered Label. After this, enter the Description for the Big Object and it is optional to do so.
The Deployment Status will be In Development by default.
At last, click on the Save button.

5. As we click the Save button, the custom Big Object will be created, and the related details will be displayed.
We can also edit and delete this big object by clicking the Edit and Delete button.

6. As of now, the Big Object is in development status]. To deploy the custom big object, click on the Edit button, and in the Deployment Status section, select Deployed and click Save.

In this way, we can create a Custom Big Object in Salesforce by following the above steps.
Create Fields in Salesforce Big Object
In Salesforce, big objects have custom fields defined to store unique and different data. Once we define our big objects, we can add the custom fields. We can also build a custom relationship field that can link our big objects with another object in Salesforce.
Now follow the steps below to create a field in Salesforce Big Object.
1. To create the custom fields, open a big object, scroll down to the section Custom Fields & Relationships, and click on the New button.

2. Now choose the data type for the custom field and click on the Next button. In this example, I have selected the Text Area (Long) field.

3. Enter the required details like Field Label and Field Name. We can also enter the Description and set the default value for the custom field.
After this, click on the Next button.

4. Now, establish the field-level security and click the next button.

5. At last, confirm the information by simply clicking on the Save button.

6. As we can see, the custom field is created in the Big Object, and it is visible in the section Custom Fields and Relationships.

This is how we can add or create a field in a standard or custom Salesforce Big Object.
Add Index to Custom Big Objects in Salesforce.
To make a field indexed in Salesforce Big Objects, the first requirement is to mark the fields as required because the index defines the composite primary key for a big object. The fields defined in a big object’s index determine the big object’s identity, and with this indexed field, we can query the Salesforce big objects.
1. After creating the required fields for the big object, go to the Index section in the big object and click on the New button.

2. In the new index setup, enter the Label and Name for the big object index. Then, in the Index Fields, you will only see those fields that are marked as required.
These fields define the uniqueness of each record in the big object, and you can index up to 5 required fields in big objects.
Select the Index Position and Index Direction for the available index fields and click on the Save button.

Now, the Custom Index with the indexed fields will be created for the Salesforce Big Object.

This way, we can create the Index and add indexed fields in Salesforce big objects.
How to Add Records in Custom Big Objects?
There are various methods that we will discuss to add records or populate the Custom Big Objects. The Big objects can not be accessed through an app or the object manager, so we use Apex methods to populate the data in Salesforce Big Objects.
Insert data in Salesforce Big Objects through the Synchronous Insertion.
For the synchronous insertion of big object data through Apex, we will use the Database.insertImmediate() method.
Anonymous Apex code:
List<USA_customer_history__b> bigObjectRecords = new List<USA_customer_history__b>();
for (Integer i = 1; i <= 10; i++) {
bigObjectRecords.add(new USA_customer_history__b(
Customer_ID__c = '21548aa' + i,
Customer_name__c = 'Steve' + i,
Customer_Email__c = 'steve' + i + '@mail.com'
));
}
Database.SaveResult[] results = Database.insertImmediate(bigObjectRecords);
for (Database.SaveResult sr : results) {
if (sr.isSuccess()) {
System.debug('Inserted successfully: ' + sr.getId());
} else {
System.debug('Error: ' + sr.getErrors()[0].getMessage());
}
}In the above code, we have defined the custom big object in the List. In the first for loop, we have populated the records for insertion. Then, we used the ‘Database.insertImmediate‘ method for synchronous insertion.
Ensure you have included the indexed fields while populating the data of the big object.
After executing the anonymous code, the data will be populated in the defined big object.
The debug log shows the debug statement after successfully inserting records in the big object.

We can also retrieve the big object data through the SOQL query by executing the query using the following syntax.
SELECT Customer_ID__c, Customer_name__c FROM USA_customer_history__bIf you want to add filter conditions in the SOQL query using the WHERE clause, you can only use the indexed fields with the clause.

This way, we can populate the Salesforce Big Objects through the synchronous insertion method.
Insert data in Salesforce Big Objects through the Asynchronous Insertion
To populate the data in Salesforce Big Objects through Asynchronous insertion, we will use the ‘Database.insertAsync‘ method.
Now, execute the Apex anonymous code below to populate the data in the custom big object.
List<USA_customer_history__b> bigObjectRecords = new List<USA_customer_history__b>();
for (Integer i = 1; i <= 10; i++) {
bigObjectRecords.add(new USA_customer_history__b(
Customer_ID__c = '54552b' + i,
Customer_name__c = 'Customer' + i,
Customer_Email__c = 'User' + i + '@mail.com'
));
}
Database.SaveResult[] results = Database.insertImmediate(bigObjectRecords);
for (Database.SaveResult sr : results) {
if (sr.isSuccess()) {
System.debug('Inserted successfully: ' + sr.getId());
} else {
System.debug('Error: ' + sr.getErrors()[0].getMessage());
}
}After execution of the above anonymous code, the data will be populated in the Custom Big object.
The asynchronous method takes time to execute and reflect the changes. If you are unable to query the populated data through the async method, then you can use the Salesforce workbench to run the SOQL query and retrieve the added data.
SOQL query to retrieve Big Object data.
SELECT Customer_ID__c, Customer_name__c FROM USA_customer_history__bIn the query results, you will see the data of records we added through the ‘Database.insertAsync‘ method.

This way, we can populate the data in Salesforce Big Objects using the ‘Database.insertAsync‘ method in asynchronous insertion.
Conclusion:
I hope now you have an idea of the custom big object and field in Salesforce and how to create a custom big object and field in Salesforce big objects.
It also gives compatible performance for billions or more records. With the standard APIs, the big objects are available in our external system or in our org.
You may also like to read the following articles:
- How to add address field to custom object in Salesforce
- How to remove new event button from case object in salesforce
- Create a Custom Object from a Spreadsheet in Salesforce Lightning Experience
I am Bijay Kumar, the founder of SalesforceFAQs.com. Having over 10 years of experience working in salesforce technologies for clients across the world (Canada, Australia, United States, United Kingdom, New Zealand, etc.). I am a certified salesforce administrator and expert with experience in developing salesforce applications and projects. My goal is to make it easy for people to learn and use salesforce technologies by providing simple and easy-to-understand solutions. Check out the complete profile on About us.