DynamoDB Data Model Overview - Table, Item, Attribute and Data Types

Data model for DynamoDB comprises of tables, items (rows) and attributes.

 

Table

A table is a collection of data items.

Table can have a single primary key called partition key or a composite key which contains both partition key and sort key.

 

Item (row)

An item is synonymous to a row in a traditional database.

There can be infinite number of data items.

An Item is composed of a primary or composite key and a flexible number of attributes.

The aggregate size of an item, including all the attribute names and attribute values, cannot exceed 400KB.

 

Attribute

Each attribute is composed of an attribute name and a value or set of values.

Individual attributes have no explicit size limit, but the total value of an item (including all attribute names and values) cannot exceed 400KB.

DynamoDB is schema-less. You can have different set of attributes for different items (records). Same attribute can also have different types (e.g. String and Number) for different items (rows).

 

Data Types

DynamoDB supports four scalar data types: Number, String, Binary, and Boolean.

DynamoDB also supports collection data types: Number Set, String Set, Binary Set, heterogeneous List and heterogeneous Map.

Elements of Sets are of same type, and order is not significant. In list, order is maintained and can have data of different types. Map is unordered and can have nested structures upto 32 levels. 

DynamoDB also supports NULL values.

Special Note:

  1. Only available types to select for primary key fields are: String, Binary, Number.

  2. DynamoDB does not have a JSON data type. However, you can pass JSON data directly to DynamoDB through document SDK and it will automatically map JSON documents onto native DynamoDB data types.

 

DynamoDB Data Model Limitations

  1. For any AWS account, there is an initial limit of 256 tables per region. This can be changed by contacting support.

  2. There is no practical limit on a table's size.

  3. Names for tables and secondary indexes must be at least 3 characters long, but no greater than 255 characters long. Allowed characters are: A-Z, a-z, 0-9, _ (underscore), - (hyphen) and . (dot)

  4. In general, an attribute name must be at least 1 character long, but no greater than 64 KB long.

    1. However, following attribute names must be no greater than 255 characters long: secondary index keys, names of any user-specified projected attributes (applicable only to local secondary indexes).

  5. Attribute names must be encoded using UTF-8, and the total size of each name (after encoding) cannot exceed 255 bytes.

  6. Aggregate size of an item, including all the attribute names and attribute values, cannot exceed 400KB.

  7. No explicit limitation on the number of attributes associated with an item.

  8. Individual attributes have no explicit size limit.

Learn Serverless from Serverless Programming Cookbook

Contact

Please first use the contact form or facebook page messaging to connect.

Offline Contact
We currently connect locally for discussions and sessions at Bangalore, India. Please follow us on our facebook page for details.
WhatsApp (Primary): (+91) 7411174113
Phone (Escalations): (+91) 7411174114

Business newsletter

Complete the form below, and we'll send you an e-mail every now and again with all the latest news.

About

CloudMaterials is my blog to share notes and learning materials on Cloud and Data Analytics. My current focus is on Microsoft Azure and Amazon Web Services (AWS).

I like to write and I try to document what I learn to share with others. I believe that knowledge is useless unless you share it; the more you share, the more you learn.

Recent comments

Photo Stream