Newer Version Available

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

SOQL with Big Objects

You can query the fields in a big object’s index using a subset of standard SOQL commands.

Build an index query starting from the first field defined in the index, without gaps between the first and last field in the query. You can use =, <, >, <=, or >=, or IN on the last field in your query. Any prior fields in your query can only use the = operator. The !=, LIKE, NOT IN, EXCLUDES, and INCLUDES operators are not valid in any query.

The system fields CreatedById, CreatedDate, SystemModstamp can be included in queries. Do not use the Id field in a query. Including Id in a query returns only results that have an empty ID (000000000000000 or 000000000000000AAA).

The following queries assume that you have a table in which the index is defined by LastName__c, FirstName__c, and PhoneNumber__c.

This query specifies all three fields in the index. In this case, the filter on PhoneNumber__c can be a range.

1SELECT LastName__c, FirstName__c, PhoneNumber__c
2FROM Phone_Book__b
3WHERE LastName__c='Kelly' AND FirstName__c='Charlie' AND PhoneNumber__c='2155555555'

This query specifies only the first two fields in the index. In this case, the filter on FirstName__c can be a range.

1SELECT LastName__c, FirstName__c, PhoneNumber__c
2FROM Phone_Book__b
3WHERE LastName__c='Kelly' AND FirstName__c='Charlie'

This query specifies only the first field in the index. The filter on LastName__c can be a range.

1SELECT LastName__c, FirstName__c, PhoneNumber__c
2FROM Phone_Book__b
3WHERE LastName__c='Kelly'

This query doesn’t work because of a gap in the query where FirstName__c is required.

1SELECT LastName__c, FirstName__c, PhoneNumber__c
2FROM Phone_Book__b
3WHERE LastName__c='Kelly' AND PhoneNumber__c='2155555555'

These restrictions do not apply to Async SOQL queries against big objects.

Note