3

While reading the Big Object related documentation, I was curious as to what does the following statement mean?

  • Big objects don’t support transactions including both big objects, standard object and custom objects.

Consider the following scenario:

  1. External system pushing records into BigObjects (Platform/Enterprise WSDL)
  2. SOQL to retrieve the records and work off the records to create a custom/standard Sobject record. (Async SOQL not an option because I do not wish to use target sObject to store the retrieved records)
  3. Update the BigObject using the "insertImmediate" method with a status as "Processed"

You can create and update custom big object records in Apex using the insertImmediate method -- Reference: Documenation - Page 9 Populate Custom BigObject with Apex

Doesn't the above scenario mean that I would be involved in an Apex transaction with custom Objects as well as the Big Objects?

1 Answer 1

3

You are ok to query for Custom/Standard objects but your scenario will not work if you use DML on the Custom/Standard objects followed by an insert on a Big Object unless the Big Object operation is done asynchronously you will get an error. See Database.insertImmediate here. You can insert a Big Object record first and then do DML on a Custom/Standard object but not the opposite direction.

5
  • Will this scenario work? Use SOQL to retrieve records from a Custom Object and use those set of records to insert into BigObjects using insertImmediate method? This is working for me in anonymous Apex, but from this discussion, looks like it's throwing error. Thoughts?
    – Sagar
    Commented Mar 21, 2018 at 22:06
  • @Sagar are you doing this in a trigger like in that discussion thread? SOQL on a Standard Object is not an issue but DML on a Standard Object is, so you'd need to call the big object update asynchronously.
    – Jenny B
    Commented Mar 22, 2018 at 22:58
  • do you know why I can't do a DML on the Standard/Custom object followed by a DML on the BigObjects and followed by a DML on the Standard/Custom object? I am trying to wrap my head around the fact that DML on BigObjects are actually Callouts? I found out the reason why? Update: [developer.salesforce.com/docs/atlas.en-us.apexcode.meta/…
    – Sagar
    Commented Apr 3, 2018 at 23:17
  • 1
    @Sagar the link isn't working for me but take a look at the insertImmediate method here: developer.salesforce.com/docs/atlas.en-us.apexcode.meta/… You can either insert the Big Object first and then the SObject or do the insert on the Big Object asynchronously.
    – Jenny B
    Commented Apr 9, 2018 at 13:12
  • @JennyB Does that mean if you retrieved Big Object using SOQL it won't amount to heap size?
    – d_k
    Commented Feb 10, 2020 at 10:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .