2

I am wondering if I have a field in my DynamoDB that has a dictionary of size 1KB, and I update one of the key-value pairs in my dictionary by iterating a number forward by '1', will amazon charge me for the 8 bytes it takes to write an integer, or will amazon charge me a 1KB write operation to change a small subset of my dictionary?

user1709076
  • 2,538
  • 9
  • 38
  • 59
  • You can test this out by enabling the flag on the request that tells dynamo to return the consumed capacity. – Max Feb 22 '16 at 06:24

1 Answers1

2

Any write operation in Dynamo consumes at least 1 write unit, so for a 1KB (or smaller) object you'd consume 1 write unit even if incrementing a counter. But if the item is 2KB you'll consume 2 write units.

Writes Number of item writes per second × 1 KB item size

http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ProvisionedThroughputIntro.html#ProvisionedThroughputIntro.Writes

aaaristo
  • 2,079
  • 14
  • 11
  • Thanks, I turned on updateItem.returnConsumedCapacity = true and found returned that capacityUnits = 1. Seems like this could get expensive really fast and that if amazon 'rounds-up' to the nearest KB, it would be in my best interest to make sure that each field has at least 1KB of data in it to get the most value – user1709076 Feb 22 '16 at 15:34
  • "each field has at least 1KB" is ITEM based not field based, so you want to have the KB filled at item level eventually, but i guess it really depends on your use case – aaaristo Feb 23 '16 at 18:33