If we are trying to insert many records in dynamoDb using batchWrite, then DynamoDb may optimize the BatchWrite operation such that the total size WCU consumed would be less than the total sum of each item combined.
For Example:
Assume I’m trying to insert 1000 records, each record of 1 KB Size (1 WCU = 1 KB). If I insert each item individually using PUTItem
, It would cost 1000 WCU. However, if I use batchWrite, then dynamoDb may optimize the batch operation such that total cost would be less than 1000 WCU.
However, I haven’t found any details on how does dynamoDb optimize WCU during the batch write operation.
2
Answers
You haven’t found any details because the pricing for batch writes is the same as if you did individual writes. The batch feature is a speed optimization.
The premise is flawed. That’s not what BatchWriteItems does. It’s intended to speed up processing by allowing you to parallelize write operations. It is not a way to save on WCUs.
From the docs, emphasis mine.
but: