delhics
delhics

Reputation: 97

Limit on Number of Attributes in Table DynamoDB?

Hi I currently have a list of dictionaries I am trying to insert into DynamoDB (each dict as an item). Each item having a hashkey and label1,label2,...label3000 key/value pairs with label# being the key and a string as the value pair. Some of my items have up to label fields. Is this a problem when using put_item in DynamoDB? Currently, the label# keys within each dictionary are unordered, and when I go to insert each item it is only adding 19 of the fields.

Upvotes: 6

Views: 12543

Answers (3)

Shwetabh Shekhar
Shwetabh Shekhar

Reputation: 3034

A Dynamodb table can have any number of attributes but while writing a particular row the number of attributes is limited as the cumulative size of an attribute name and attribute value should not exceed 400KB.

Mathematically speaking if the row you are writing has an average attribute size of 7 bytes and the corresponding value for it has a size of 6 bytes then you can have approximately 400 * 1024/13 ~ 31507 attributes for that entry.

If you make another such entry with an entirely different attribute name set then overall your table will have 63014 attributes.

Keep in mind each entry has a limit of 400KB, but the table can have any number of attributes.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-attributes

Upvotes: 4

AlexM
AlexM

Reputation: 7

The "limit" is just in view, by default is 20 columns.
You can select to view all columns using the settings button.

enter image description here

Upvotes: -1

tleef
tleef

Reputation: 3594

There is no limit to the number of attributes but the total item size is limited to 400kb.

Items

Item Size

The maximum item size in DynamoDB is 400 KB, which includes both attribute name binary length (UTF-8 length) and attribute value lengths (again binary length). The attribute name counts towards the size limit.

For example, consider an item with two attributes: one attribute named "shirt-color" with value "R" and another attribute named "shirt-size" with value "M". The total size of that item is 23 bytes.

Attributes

Attribute Name-Value Pairs Per Item

The cumulative size of attributes per item must fit within the maximum DynamoDB item size (400 KB).

Number of Values in List, Map, or Set

There is no limit on the number of values in a List, a Map, or a Set, as long as the item containing the values fits within the 400 KB item size limit.

Docs

Upvotes: 8

Related Questions