DynamoDB: How to store a list of items DynamoDB: How to store a list of items database database

DynamoDB: How to store a list of items


Actually, the approach depends on the Query Access Pattern (QAP).

Approach 1:-

  1. Typical, normalized approach similar to RDBMS design. However, we need to think this on NoSQL perspective. There is no join in DynamoDB. Potentially, you may need to read two tables to get the required data. Please note that cost is calculated based on Read Capacity Units. So, the two different reads will cost you.

  2. This approach may be acceptable if the item size exceeds theDynamoDB item size 400 KB

  3. You can write query expression to filter the data by attributes attrX, attrY and attrZ as they are stored as normal scalar data type attributes

Approach 2:-

  1. Preferred NoSQL approach to keep all the required data in one table.Join or additional read is not required

  2. Need to consider whether the item size can exceed 400 KB

  3. Whether you need to write query to filter the data by attributesattrX, attrY and attrZ. Please note that in this approach the ListCdata is stored as List of Map DynamoDB data type. In most scenarios, DynamoDB doesn't have the flexibility to query the complex data structures like this (i.e. Map inside List data type)

List of Objects - means List of Map on DynamoDB database

{ X: "2.8", Y: "nop" } - is the object. This translates to MAP data type on DynamoDB database.

The outside square bracket translates to LIST data type on DynamoDB