1

From Working with Items: Java I know that it is possible to "update" an item using putItem. putItem will replace the entire item. However it is recommended to use updateItem because updateItem method will only modify the item attributes that you specify in the input, and the other attributes in the item will remain unchanged.

My question is 'is there any performance difference between replacing entire item and updating required fields in amazon dynamo db'

what is the impact on performance if the number of items to update is

  • small
  • large

A question on difference between two functions has been asked here. But i want a detailed answer regarding performance differences.

Neil Lunn
  • 148,042
  • 36
  • 346
  • 317
Maria
  • 123
  • 8

1 Answers1

2

A put or a partial update will consume the same amount of throughput when you write an item to DynamoDB.

From the documentation: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/CapacityUnitCalculations.html

PutItem—writes a single item to a table. If an item with the same primary key exists in the table, the operation replaces the item. For calculating provisioned throughput consumption, the item size that matters is the larger of the two.

UpdateItem—modifies a single item in the table. DynamoDB considers the size of the item as it appears before and after the update. The provisioned throughput consumed reflects the larger of these item sizes. Even if you update just a subset of the item's attributes, UpdateItem will still consume the full amount of provisioned throughput (the larger of the "before" and "after" item sizes).

JaredHatfield
  • 6,381
  • 2
  • 29
  • 32
  • so does this means both queries will take same "time" and "space"?? – Maria Sep 12 '17 at 11:13
  • 2
    For "space" both queries will end up taking up the same amount of storage in the end. For "time," I do not believe this is an implementation detail that AWS shares, but for practical purposes it should be safe to assume they are the same. – JaredHatfield Sep 12 '17 at 15:31