Chrisschunn
Chrisschunn

Reputation: 43

When storing objects with over 15 attributes inside of dynamodb is it best to store as an object inside of value or spread them across the columns?

So I decided to try something new when it comes to working with databases. I am following the one table design that was outlined by : Rick video here.

The one thing I am wondering is if I have an item to store inside the database specifically dynamodb will the cost be the same or different if I am spreading the attributes into their own columns or would it best to store an object (in this case store a list of map items) inside of one column instead of 15 columns? Also, is there a performance difference as well when reading across columns vs reading a larger object?

Ex. |userid|itemid|dataObject| vs |userid|itemid|dataObjectAttribute1|dataObjectAttribute2|...|dataObjectAttribute15

Upvotes: 2

Views: 442

Answers (1)

Phan Việt
Phan Việt

Reputation: 1343

Short answer: Save separate attributes.

Reason for saved separate attributes:

Reason for saved embed attributes as Map:

  • Quick and simple.
  • You don't need any indexes on those attributes, just save as raw data and always return all
  • You need something as data unstructrure/dynamic, or grouping attributes

Upvotes: 2

Related Questions