9
votes

I'm currently working out if I will use DynamoDB for some of a Project. I want to know if I execute a query against the Database for a specific Key and it isn't found (eg: see if this UserID is present and get contents if it is) is this Query that returns no results considered a Read and Chargeable?

I expect I will do a certain amount of queries that won't return results (polling for information) and need to factor this in.

Below is from the AWS website: http://aws.amazon.com/dynamodb/pricing/

"Note that the required number of units of Read Capacity is determined by the number of items being read per second, not the number of API calls. For example, if you need to read 500 items per second from your table, and if your items are 1KB or less, then you need 500 units of Read Capacity. It doesn’t matter if you do 500 individual GetItem calls or 50 BatchGetItem calls that each return 10 items."

2

2 Answers

12
votes

You can simply check it by calling DynamoDB and looking at ConsumedCapacityUnits in the result.

For example, if you are calling a simple getItem call for an item that exists, you get something like:

Result: {Item: {fans={SS: [Billy Bob, James], }, name={S: Airplane, }, year={N: 1980, }, rating={S: *****, }}, 
  ConsumedCapacityUnits: 0.5, }

However, when you are calling it on an item that doesn't exist, you get:

Result: {ConsumedCapacityUnits: 0.5, }

Therefore, it appears that you are consuming your capacity even if the item is not in the table, as the lookup is running nevertheless

1
votes

According to this link, there's a difference between Scan and Query operations. A query with no result will not result in any cost.