I don't see anything in the DynamoDB docs that suggest there is an ordering guarantee when using BatchWriteItem
. However, the docs do say
The individual PutItem and DeleteItem operations specified in BatchWriteItem are atomic; however BatchWriteItem as a whole is not. If any requested operations fail because the table's provisioned throughput is exceeded or an internal processing failure occurs, the failed operations are returned in the UnprocessedItems response parameter. You can investigate and optionally resend the requests. Typically, you would call BatchWriteItem in a loop. Each iteration would check for unprocessed items and submit a new BatchWriteItem request with those unprocessed items until all items have been processed.
The very idea that some of the requests may end up as unprocessed
suggests that order is not guaranteed.
I don't have specific knowledge about how BatchWriteItem
ordering is or isn't handled, but wanted to point this out in the event your use case can't handle that uncertainty.
If order is important, you could just fire off multiple requests in-order.
If you're able to share more about the details of your use-case, I'm sure the community could make recommendations that directly address the problem you're trying to solve.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…