Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS DynamoDB Query Call (with no results) Cost

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."

like image 935
Adam Avatar asked Dec 22 '12 03:12

Adam


People also ask

How much does it cost to use DynamoDB?

DynamoDB Streams are charged at $0.02 per 100,000 read operations. Data requested by requesters outside the AWS region where the DynamoDB table is deployed is charged at $0.09 per GB.

What does the Query operation in Amazon DynamoDB allow you to do?

The Query operation allows you to limit the number of items that it reads. To do this, set the Limit parameter to the maximum number of items that you want. For example, suppose that you Query a table, with a Limit value of 6 , and without a filter expression.

Which is faster scan or Query in DynamoDB?

For faster response times, design your tables and indexes so that your applications can use Query instead of Scan . (For tables, you can also consider using the GetItem and BatchGetItem APIs.)


2 Answers

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

like image 73
Guy Avatar answered Nov 07 '22 21:11

Guy


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

like image 40
pomelole Avatar answered Nov 07 '22 21:11

pomelole