In today’s data-driven world, businesses constantly struggle to manage and analyze vast amounts of information. Salesforce, a leading customer relationship management (CRM) platform, has risen to this challenge with the introduction of Big Objects. This powerful feature allows organizations to store and manage massive datasets directly within the Salesforce platform.
By 2025, it’s estimated that 463 exabytes of data will be created each day globally. These numbers underscore the growing importance of efficient large-scale data storage solutions like Salesforce Big Objects.
What is a Big Object in Salesforce?
Big Objects are custom Salesforce objects designed to store and manage massive amounts of data, up to billions of records. They provide a scalable solution for retaining and accessing historical data, tracking high-volume data changes, and integrating external big data systems with Salesforce.
Key features of Big Objects include:
- Massive data storage capacity
- High-performance queries on large datasets
- Seamless integration with Salesforce platform features
- Support for field history tracking and archiving
How to Use Big Objects in Salesforce
Big Objects in Salesforce are designed to handle and store large datasets, enabling businesses to manage historical data and track changes efficiently. Here’s how you can use Big Objects:
- Store Historical Data: Big Objects are ideal for storing non-transactional, historical data, such as customer interactions, system logs, or transactional archives.
- Track Data Changes: Use Big Objects to track data changes over time for analysis or auditing purposes.
- Custom Integrations: Integrate Big Objects with external data systems to manage large-scale data operations across different platforms.
- Optimize Performance: When working with large datasets, utilize indexed fields to optimize query performance, speeding up data retrieval.
- Report Generation: While Big Objects aren’t directly reportable, you can use custom solutions like Apex classes to extract data from Big Objects and create custom reports.
How to Create Big Objects in Salesforce
Creating a Big Object in Salesforce involves several key steps:
1. Navigate to Big Objects in Setup:
- From Setup, enter “Big Objects” in the Quick Find box.
- Click on “Big Objects” under the Create section.
2. Create a New Big Object:
- Click “New” to create a new Big Object.
- Define the object’s Label, Plural Label, and Object Name.
- Choose the Fields for your Big Object (minimum one field must be marked as the primary key).
3. Index Fields:
- Define the fields that will be indexed. Indexed fields are essential for optimizing queries on large datasets.
4. Save and Deploy:
- After defining your fields and indexes, click “Save.”
- Deploy the Big Object by clicking on the “Deploy” button.
5. Populate Data:
- Populate your Big Object using Apex, Bulk API 2.0, or REST API.
Big Objects Best Practices
To maximize the benefits of Big Objects, consider these best practices:
- Use Big Objects for appropriate use cases, such as storing historical data or high-volume transactional data.
- Design your Big Object schema carefully, as it cannot be modified after deployment.
- Implement efficient indexing strategies to optimize query performance.
- Leverage async operations for data insertion and deletion to manage large volumes effectively.
- Use custom metadata types to manage Big Object configurations.
Define and Deploy Custom Big Objects
To create a custom Big Object:
- From Setup, enter “Big Objects” in the Quick Find box and select Big Objects.
- Click “New” to start the creation process.
- Define the object’s fields, including at least one field as the primary key.
- Create an index to optimize query performance.
- Save and deploy the Big Object.
Populate a Custom Big Object
There are several ways to populate a Big Object:
- Apex: Use the Database.insertImmediate() method for synchronous insertions or Database.insertAsync() for asynchronous operations.
- REST API: Utilize the Composite resource for bulk insertions.
- Bulk API 2.0: Ideal for loading large volumes of data.
Example Apex code for asynchronous insertion:
List<MyBigObject__b> records = new List<MyBigObject__b>();
// Populate the list with records
Database.insertAsync(records, new AsyncCallback());
public class AsyncCallback implements Database.AsyncCallback {
public void callback(Database.BatchResult[] results) {
// Handle the results
}
Delete Data in a Custom Big Object
Deleting data from a Big Object requires using the Database.deleteAsync() method or the Bulk API 2.0. Here’s an Apex example:
List<MyBigObject__b> recordsToDelete = [SELECT Id FROM MyBigObject__b WHERE CreatedDate < :oldestDate LIMIT 10000];
Database.deleteAsync(recordsToDelete, new AsyncCallback());
Also Read – Introduction to Salesforce sObjects
Big Objects Queueable Example
Using a Queueable Apex class allows for better control over asynchronous operations:
public class BigObjectQueueable implements Queueable {
public void execute(QueueableContext context) {
List<MyBigObject__b> records = new List<MyBigObject__b>();
// Populate the list with records
Database.insertAsync(records, new AsyncCallback());
}
}
// Enqueue the job
System.enqueueJob(new BigObjectQueueable());
Big Object Query Examples
Querying Big Objects requires using SOQL with some limitations. Here are a few examples:
// Basic query
SELECT Field1__c, Field2__c FROM MyBigObject__b WHERE IndexedField__c = ‘Value’
// Query with ORDER BY (must use indexed field)
SELECT Field1__c FROM MyBigObject__b WHERE IndexedField__c > ‘Value’
ORDER BY IndexedField__c DESC LIMIT 100
// Query with date range
SELECT COUNT() FROM MyBigObject__b WHERE CreatedDate >= 2023-01-01T00:00:00Z AND CreatedDate < 2023-02-01T00:00:00Z
View Big Object Data in Reports and Dashboards
While Big Objects aren’t directly reportable, you can create custom report types based on Big Object data:
- Create an Apex class that queries the Big Object and returns the data as a wrapper object.
- Create a custom report type based on this Apex class.
- Build reports and dashboards using this custom report type.
SOQL with Big Objects
When using SOQL with Big Objects, keep these points in mind:
- Queries must use indexed fields in the WHERE clause.
- JOINs are not supported.
- Aggregate functions are limited (COUNT is supported).
- LIMIT clause is required and cannot exceed 10,000 records.
Big Objects in Salesforce Limitations
Although Big Objects offer significant advantages for large-scale data storage, they come with certain limitations:
1. Immutable Schema: Once deployed, the schema of a Big Object cannot be modified. You cannot add or change fields after deployment.
2. Limited SOQL Support:
- Only indexed fields can be used in WHERE clauses.
- JOINs are not supported.
- Limited aggregate functions (e.g., COUNT is allowed, but others like SUM or AVG are not).
- SOQL queries on Big Objects require a LIMIT clause (maximum of 10,000 records).
3. No Support for Standard Features:
- Big Objects cannot be used with certain Salesforce features like formulas, validation rules, or triggers.
- They also cannot be referenced in Salesforce reports, dashboards, or workflow rules.
4. Asynchronous Operations: Data manipulation, such as inserts or deletes, must be done asynchronously using Database.insertAsync() and Database.deleteAsync().
5. Reporting and Dashboards: Big Objects data cannot be directly included in standard Salesforce reports and dashboards. You’ll need custom solutions or external integrations to visualize this data.
Conclusion
Salesforce Big Objects provide a powerful solution for managing large-scale data within the Salesforce ecosystem. By leveraging this feature, organizations can unlock new possibilities in data analysis, historical tracking, and integration with external big data systems. As data continues to grow exponentially, tools like Big Objects will become increasingly crucial for businesses aiming to harness the full potential of their information assets.
Sign up with saasguru today and dive into 30+ Salesforce Certification Courses, tackle 50+ Mock Exams, and get hands-on with 50+ Salesforce Labs. Elevate your skills, boost your confidence, and become the Salesforce consultant you’ve always aspired to be.
Don’t wait—start your journey with saasguru now and lead the way in Salesforce excellence!
Frequently Asked Questions (FAQs)
1. What’s the maximum number of records a Big Object can hold?
Big Objects can hold billions of records, with no specific upper limit defined by Salesforce.
2. Can I modify a Big Object’s schema after deployment?
No, Big Object schemas are immutable after deployment. Careful planning is essential.
3. How do Big Objects differ from standard custom objects?
Big Objects are designed for massive scale, have different querying mechanisms, and cannot be used in all standard Salesforce features.
4. Are there limits on the number of Big Objects I can create?
Yes, the number of Big Objects you can create depends on your Salesforce edition and license.
5. Can I use Big Objects in Salesforce formulas or validation rules?
No, Big Objects cannot be referenced in standard formulas or validation rules due to their unique nature.