Home > Enterprise >  How to copying bulk document using transactional batch and how it is different with Stored procedure
How to copying bulk document using transactional batch and how it is different with Stored procedure

Time:09-22

I have to copy bulk data in container i was doing that using stored procedure. now i want to using transcational batch but i am not getting how to do that. I am new to this azure cosmos.

CodePudding user response:

TransactionalBatch conceptually is not for Bulk operations, it is meant for you to define a group of operations belonging to the same Partition Key that you want to execute as a unit. In the past, that could only be done through a Stored Procedure. For example, if your Stored Procedure created 10 documents inside, you can create a TransactionalBatch that performs 10 creates and it achieves the same thing. Because all operations share the same transactional scope, if one fails, the entire group fails (they commit all or none).

Bulk on the other hand is about processing a large number of operations trying to leverage all your available throughput (RU/s). The documents processed through Bulk can belong to different Partition Key values and can fail independently (you can send 100K documents and 1K can fail but 99K succeed). Bulk is exposed through container.executeBulkOperations on the V4 Java SDK, there is a complete walk through at https://learn.microsoft.com/azure/cosmos-db/sql/bulk-executor-java

  • Related