DynamoDB Best Practices
Efficient Key Design
- Partition key should have many unique values
- Distribute reads / writes uniformly across partitions to avoid hot partitions
- Store hot and cold data in separate tables
- Consider all possible query patterns to eliminate use of scans and filters
- Choose sort key depending on your application's needs
- Use indexes based on when your application's query patterns
- Use primary key or LSIs when strong consistency is desired
- Use GSIs for finer control over throughput or when your application needs to query using a different partition key
- Use shorter (yet intuitive!) attribute names
Storing Large Item Attributes
- Use compression (GZIP)
- Use S3 to store large attributes
- Split large attributes across multiple items
Reading
- Avoid scans and filters
- Use eventual consistency for reads
LSIs
- Use LSIs Sparingly
- Project fewer attributes
- Watch for expanding item collections (10GB size limit!)
GSIs
- Project fewer attributes
- Can be used for eventually consistent read replicas
'AWS Database > AWS DynamoDB' 카테고리의 다른 글
[AWS Certificate]-DynamoDB Backup & Restore (0) | 2022.01.09 |
---|---|
[AWS Certificate]-DynamoDB Accelerator (DAX) (0) | 2022.01.08 |
[AWS Certificate]-DynamoDB Storing Larger Item (0) | 2022.01.08 |
[AWS Certificate]-DynamoDB Partition (0) | 2022.01.08 |
[AWS Certificate]-DynamoDB (0) | 2022.01.08 |