0

Does using a GSI with an attribute expression reduce your read costs since you're only returning a subset of attributes from a query? Or does AWS charge you for the reading the full row and considers that they're only filtering the data for you but still read the whole row before returning a subset of attributes?

If this doesn't reduce our costs, then what other ways has anyone used (besides creating two tables) to reduce their read costs?

We want to use a Global Secondary Index (GSI) with attribute expressions for a subset of attributes in our DynamoDB table.

This enables us to return on the data we need for a set of queries.

However, it's unclear from AWS documentation whether using a GSI with attribute expressions reduces our read costs for DynamoDB.

We've implemented the GSI with an attribute expression that includes the attributes we need for a given query. These attributes are a subset of all the attributes in our table.

Logan
  • 21
  • 4

2 Answers2

1

When you read GSI, the database does not read the entire row of the base table, it only reads the attributes you included in the GSI when you created it, so the database should consume fewer RCU/RRUs. Please see here.

Alex Chadyuk
  • 1,421
  • 2
  • 10
0

When making the GSI, you can control what attributes to project into the GSI. Fewer attributes will save cost.

When querying the GSI (or a base table), you can control the expression attribute values which will come out of the query. This doesn't reduce database costs, it just reduces the network transfer.

hunterhacker
  • 6,378
  • 1
  • 14
  • 11