DynamoDB - MacKittipat/note-developer GitHub Wiki
There is no concept of Database in DynamoDB. There is no way to group tables together.
Core Component
- Table
- Consist of items.
- It is schemaless.
- Split in to many partition.
- Item
- A group of attributes that is uniquely identifiable among all of the other items.
- Maximum item size is 400KB.
- Attribute
- Each item is composed of one or more attributes.
Primary Key
There are 2 type of Primary key.
- Simple Primary Key
- Consist of partition key only.
- Composite Primary Key
- Consist of partition key and sort key.
Key Type
- Partition Key
- Determines the partition in which the item will be stored.
- Can use
=
operation for query.
- Sort Key
- Sort item in partition
- All items with the same partition key are stored together in sorted order by sort key.
- Can use
=, >, <, >=, <=, Between and BeginWith
operation for filter.
Capacity Units
- Each table has RCU/WCU assigned.
- 1 RCU can read up to 4KB / sec.
- 1 WCU can write up to 1KB / sec.
Index Type
- Global Secondary Index
- Create copy of table with difference primary key.
- An index with a partition key and a sort key that can be different from those on the base table.
- Operation is eventually consistency because data will be copied to GSI table.
- Limit 20 per table.
- Local Secondary Index
- Allow a table to have more than 1 sort key.
- An index that has the same partition key as the base table, but a different sort key.
- Limit 5 per table.
Reference
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.CoreComponents.html#HowItWorks.CoreComponents.TablesItemsAttributes
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.Partitions.html
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SecondaryIndexes.html