2

I am retrieving records that have been updated/deleted after every backup, i.e. Incremental backup procedure. There are different options to pursue with this:

  1. Bulk - Cannot support all the objects thus have to resort to SOAP. Does this support retrieving deleted records, i.e. isDeleted=true?
  2. SOAP - Probably the best bet to use the calls using getUpdated() and getDeleted(). However, these calls return only the relevant info such as ID, audit fields. I have to fetch the rows from my backup to scan the particular records.
  3. SOAP v2 - Use queryAll(); Query = "Select ... from ObjName where isDeleted=true or (Datefield > ... and Datefield < ...)". Datefield as some may not necessarily contain all the fields. The order for query is SystemModStamp, ModifiedDate, CreatedDate.

I am tied between the options 2 and 3. Since the backup is stored as a file, I have to perform sequential file scans to retrieve the related record information. My backup size is small and therefore both the approaches did not have much difference in execution time. However, I am not sure whether to go for approach 3 as it may incur query limits.

  • Are there any problems with writing custom queries as opposed to using the SOAP predefined calls?
  • Will going for approach 3 be slower when compared with approach 2 in overall execution time?
  • How will the approach 2 and 3 differ in query execution limits?
  • Finally, what other assumptions that I have to consider the incremental query? Example, incremental should be run every 30 days to prevent deletion from recycle bin.
1

There are deletes that can happen that only getDeleted() will be able to spot, that's the only reliable way to replicate deletes.

getUpdated() under the covers is a query based on the date column (picked based on the criteria you list in 3), so you can either do getUpdated()/retrieve, or query there's no a whole lot to choose between the 2.

However depending on how close to the current time you're trying to replicate, you may want to use getUpdated rather than query as it'll report the oldest Tx time, so that you can use that to safely roll forward your time window and not miss in progress updates.

  • There are deletes that can happen that only getDeleted() will be able to spot, that's the only reliable way to replicate deletes. Can you justify why I cannot run a queryAll with isDeleted=true option to retrieve the deleted records? – dmachop Aug 19 '15 at 20:14
  • 1
    queryAll will only return soft deleted records, not all records are soft deleted under all conditions. getDeleted() is backed by a separate delete log that capture that even in the event that the delete isn't a soft delete. – superfell Aug 19 '15 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.