Newer Version Available

This content describes an older version of this product. View Latest

Delete Data in a Custom Big Object

Use Apex or SOAP to delete data in a custom big object.
The Apex method deleteImmediate() deletes data in a custom big object. Declare an sObject that contains all the fields in the custom big object’s index. The sObject acts like a template. All rows that match the sObject’s fields and values are deleted. You can specify only fields that are part of the big object’s index. You must specify all fields in the index. You can’t include a partially specified index or non-indexed field, and wildcards aren’t supported.

The batch limit for big objects using deleteImmediate() is 2,000 records at a time.

Important

In this example, Account__c, Game_Platform__c, and Play_Date__c are part of the custom big object’s index. When specifying specific values after the WHERE clause, fields must be listed in the order they appear in the index, without any gaps.

1// Declare sObject using the index of the custom big object -->
2List<Customer_Interaction__b> cBO = new List<Customer_Interaction__b>();
3cBO.addAll([SELECT Account__c, Game_Platform__c, Play_Date__c FROM Customer_Interaction__b WHERE Account__c = '001d000000Ky3xIAB']);
4
5Database.deleteImmediate(cBO);

To use the SOAP call deleteByExample(), declare an sObject that contains the fields and values to delete. The sObject acts like a template. All rows that match the sObject’s fields and values are deleted. You can only specify fields that are part of the big object’s index. All fields in the index must be specified. You can’t include a partially specified index or non-indexed field, and wildcards aren’t supported. This example deletes all rows in which Account__c is 001d000000Ky3xIAB, Game_Platform__c is iOS, and Play_Date__c is 2017-11-28T19:13:36.000z.

Java example code:

1public static void main(String[] args) {
2  try{
3       Customer_Interaction__b[] sObjectsToDelete = new Customer_Interaction__b[1];
4       //Declare an sObject that has the values to delete
5       Customer_Interaction__b customerBO = new Customer_Interaction__b();
6       customerBO.setAccount__c (“001d000000Ky3xIAB”);
7       customerBO.setGame_Platform__c (“iOS”);
8       Calendar dt = new GregorianCalendar(2017, 11, 28, 19, 13, 36);
9       customerBO.setPlay_Date__c(dt);
10       sObjectsToDelete[0] = customerBO;
11       DeleteByExampleResult[] result = connection.deleteByExample(sObjectsToDelete);
12  }  catch (ConnectionException ce) {
13	      ce.printStackTrace();  
14  }
15}

Repeating a successful deleteByExample() operation produces a success result, even if the rows have already been deleted.

Note