No comments yet

Big Object in Salesforce

Salesforce has a limitation on performing queries on large number of records. Especially when your data is massive (assume more than 10k records per object) performing queries and performance of the system downgrades. That is where Big Object Comes in to picture. Leveraging Big Objects we can perform asynchronous queries to retrieve huge sets of data, without affecting the performance in a faster way. Big Objects can help you improve performance and scale your Implementation when your Data is huge in Salesforce!

What is Big Object

Object that stores and manages massive data values within Salesforce Without affecting performance. Big objects provide consistent performance for a billion records, and are accessible with a standard set of API’s to your org or external system.

Custom big objects can be created by the Metadata API. To define a custom big object, you need to create an object file that contains its definition, field’s, and index, with a Permission-set to define the permissions for each field, and  package file to define the contents of the object metadata.

Big Object Use Cases

  • Capture User Activity Code reviews, time entries, page views, field audits etc.
  • Retain Historical Data Historical data stored for compliance
  • 360 Customer View Ancillary customer data e.g. Purchase Details, Transactions

Deploying your Schema

Big Object

Step to Create Big Object:-

You need to create the below three files.

Step 1) Create Big Object Files:-  

1) Create an Object File :- Defines the custom big object’s fields and index, Each custom big object needs its own object file.


<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="">

        <label>My Text Field</label>
        <label>Account Lookup</label>
        <label>Date Time</label>
        <label>Number Field</label>

        <label>My First Big Index</label>
    <label>My First Big Object</label>
    <pluralLabel>My First Big Object</pluralLabel>

2) Create A Permissionset file :- with a Permissionset to define the permissions for each field


<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="">
    <label>My_First_Big_Object Permission Set</label>

3) Create package.xml file :-  file to define the contents of the object metadata


<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="">

Step 2) Deploy big object :-

1) Create the zip file for deployment.
Save all three file in one folder. Create the folder Structure like below

Add My_First_Big_Object__b.object file in Object Folder
Add My_First_Big_Object.permissionset file in permissionset Folder
package.xml file should in root of the folder.

2) Deploy with the help of Workbench or ANT Tool.

2.1) Login on workbench
2.2) Click on Migration tool in workbench and select Single Package option like below image.

2.3) Now validate the big object in your Salesforce org.

How to insert a record 

My_First_Big_Object__b obj = new My_First_Big_Object__b();
obj.Account_Lookup__c ='0019000001ukhMF';;

Big Object Data Manipulation

  • Apex CRUD
    • Create / Update (Idempotent Behavior)
    • insertImmediate(sobject) OR insertImmediate(sobjects)
  • Read
    • SOQL Queries
    • Async SOQL
  • CSV Files
    • API (Bulk API, SOAP API)

Using Standard SOQL with Big Objects

  • Executes synchronously
  • All Indexes are mandatory
  • Comparison Operators (=, <, >, <=, >=, IN)
  • Not Supported Operators

SOQL Vs Async SOQL Usage Considerations

FeatureStandard SOQLAsync SOQL
Mode of ExecutionSynchronousAsynchronous
Immediate Response Required?YesNo
Expected Result Set SizeSmaller Data Sets (Thousands of records)Large Data Sets (Millions of records)
Best Suited ForDisplaying Data on UI
Manipulations within Apex
Summarizing for Analytics
Filter using Non Index fieldsYesNo
Sample FormatSELECT Game_Platform__c, Play_Date__c
FROM Customer_Interaction__b
Game_Platform__c=’PC’ AND Play_Date__c=’2017-09-06′
{“query”: “SELECT Account_c, In_Game_Purchase__c FROM Customer_Interaction__b WHERE Play_Date__c=’2017-09-06′”,

“operation”: “insert”,
“targetObject”: “Customer_Interaction_Analysis__c”,

“targetFieldMap”: {“Account__c”:”Account__c”,“In_Game_Purchase__c”:”Purchase__c”},
“targetValueMap”:{“$JOB_ID“ : “BackgroundOperationLookup__c”,
“Copy fields from source to target“ : “BackgroundOperationDescription__c”}}

Difference Between Custom Object and Big Object

Custom ObjectBig Object
CreateManual and MetadataMetadata
API Name__c__b
Track ActivityYesNo Option
Field History TrackingYesNo Option
Data TypeAllText, Date Time, Lookup, Number,
Long Text Area
Edit FieldYesYes
Delete FieldYesNo
StorageIt Count Against StorageIt doesn’t count against Storage

Recording of session

Here is PPT of session

Considerations for Big Objects Usage

  • General
    • Metadata API
    • Max. 100 Big Objects per org
    • Supports DateTime, Lookup, Number, Text, Long Text Area field types only
    • Triggers, Flows, Processes, Salesforce App are unavailable
    • Async SOQL is restricted to specific licenses
  • UI / UX
    • Standard UI unavailable (Tabs, Detail Pages, List Views)
    • Works with Visualforce Pages or Lightning Components
  • Data Security & Access
    • Supports Object & Field Permissions only
  • Analytics
    • No support for Report Builder
    • Einstein Analytics supported
  • Packaging
    • Included in Managed Packages

Post a comment