Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does using Projection Expressinos in querying DynamoDB reduce the read capacity unit comsumption?

Have been going through the DynamoDB documentation, but couldn't verify the following.

  1. What is the main purpose of ProjectionExpression in DynamoDB?
  2. Does it reduce the read capacity unit consumption?
  3. If not - Dynamodb charges the same amount irrespective of if you read the entire item or just a few attributes?

Any help is appreciated! Thanks!

like image 469
vdk Avatar asked Oct 25 '16 00:10

vdk


People also ask

Which of the following describes how DynamoDB read operations consume read capacity units?

The following describes how DynamoDB read operations consume read capacity units: GetItem —Reads a single item from a table. To determine the number of capacity units that GetItem will consume, take the item size and round it up to the next 4 KB boundary.

How does DynamoDB determine read and write capacity?

If you need to write an item that is larger than 1 KB, DynamoDB must consume additional write capacity units. Transactional write requests require 2 write capacity units to perform one write per second for items up to 1 KB. The total number of write capacity units required depends on the item size.

How is DynamoDB read capacity calculated?

1 read capacity unit (RCU) = 1 strongly consistent read of up to 4 KB/s = 2 eventually consistent reads of up to 4 KB/s per read. 2 RCUs = 1 transactional read request (one read per second) for items up to 4 KB. For reads on items greater than 4 KB, total number of reads required = (total item size / 4 KB) rounded up.

How can I make DynamoDB query faster?

You can increase your DynamoDB throughput by several times, by parallelizing reads/writes over multiple partitions. Use DynamoDB as an attribute store rather than as a document store. This will not only reduce the read/write costs but also improve the performance of your operations considerably.


1 Answers

According to AWS CLI Command Reference: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dynamodb/query.html "DynamoDB calculates the number of read capacity units consumed based on item size, not on the amount of data that is returned to an application. The number of capacity units consumed will be the same whether you request all of the attributes (the default behavior) or just some of them (using a projection expression). The number will also be the same whether or not you use a FilterExpression"

like image 175
Hadas Katz Edry Avatar answered Oct 07 '22 14:10

Hadas Katz Edry