Amazon DynamoDB
AWS Tips I Wish I'd Known Before I Started
- DynamoDb is a noSQL schema-less storage. Each entity can have different attributes. Total item/entity size 64 KB (UTF-8), name and value count towards size
- Maximum tables 256/region/account, can request limit increase
- No practical limit in table size, bytes or items
- Attributes are name=value pairs and can be single value or multi-value set
- Attribute types: String, binary, number (38 digits of precision after the decimal point, and can be between 10^-128 to 10^+126), or sets, no empty values or sets
- Idempotent conditional updates: only applied if conditions are met, safe to retry in the event of failure to acknowledge
- Atomic counters: increment/decrement, not idempotent, use conditional for idempotent
- Consistent reads consume more resources, time, and cost more money (avoid them when possible)
- Must create indexes when tables are created, can't update, add or delete later
- Hash key distributes data among resources
- Range key partitions data
- Query is more efficient than scan, scan reads every record in the table
- Scanning always scans the entire table, slows as table grows, can consume entire provisioned throughput in a single operation
- Scan imposes 1 MB limit before filtering
- Must pre-configure read/write capacity for tables when created
- Automatic result pagination in 1 MB increments
- Result limits can be imposed
- Scans by default are sequential, can specify degree of parallelism
- Best Practices
Indexes
- Must create indexes during table create, can't update, add or delete later
Local Secondary Indexes
- Hash must be same as tables PK hash plus some other table attribute for a range key
- Each hash key is limited to 10 GB for all indexed items
- Can only query over single partition based on range key
- Queries can be either eventual or strong consistency
- Can request data not projected in the index
- Hash and range can be any table attribute
- No limit on size
- Can query over entire table
- Queries can only be eventual consistency
- Can only request data projected in the index
Comments