What common DynamoDB mistakes did I miss?
Comment them below 👇
What common DynamoDB mistakes did I miss?
Comment them below 👇
Data that will expire such as connection IDs, session data, or any data that won't be relevant after some time should have a TTL.
That data will accumulate and it will add up to your storage, deleting it manually will cost you a lot at scale.
Data that will expire such as connection IDs, session data, or any data that won't be relevant after some time should have a TTL.
That data will accumulate and it will add up to your storage, deleting it manually will cost you a lot at scale.
Don't use a get item to increment an attribute's value or add to an array.
DynamoDB offers methods like ADD and list_append to increment values and push to arrays without fetching the item before.
Don't use a get item to increment an attribute's value or add to an array.
DynamoDB offers methods like ADD and list_append to increment values and push to arrays without fetching the item before.
If your go-to approach for filtering data is using filter expressions, your costs will be higher and queries slower.
Filter expressions should be a last resort; instead filter with your sort key by adding multiple values in it and separating them with "#".
If your go-to approach for filtering data is using filter expressions, your costs will be higher and queries slower.
Filter expressions should be a last resort; instead filter with your sort key by adding multiple values in it and separating them with "#".
You also benefit from the efficency, cost-effectiveness and power of serverless.
Learn just the basics to build early, then move up from there to expand your skillset.
You also benefit from the efficency, cost-effectiveness and power of serverless.
Learn just the basics to build early, then move up from there to expand your skillset.
✅ Fetch the latest item(s) with ScanIndexForward: false
✅ Query a granular range of items with begins_with() or BETWEEN methods
💡 The sort key lets you model advanced patterns like one-to-many relationships, hierarchical models, and more
✅ Fetch the latest item(s) with ScanIndexForward: false
✅ Query a granular range of items with begins_with() or BETWEEN methods
💡 The sort key lets you model advanced patterns like one-to-many relationships, hierarchical models, and more
✔️ order#123, order#124 (to store a user's purchases)
✔️ post#101, post#102 (to store a user's blog posts)
✔️ message#001, message#002 (to store a user's chat messages)
✔️ order#123, order#124 (to store a user's purchases)
✔️ post#101, post#102 (to store a user's blog posts)
✔️ message#001, message#002 (to store a user's chat messages)
💡 Sort keys let you store multiple related items under the same partition key (aka an item collection) which lets you efficiently query these items in order.
💡 Sort keys let you store multiple related items under the same partition key (aka an item collection) which lets you efficiently query these items in order.
✅ Use unique IDs like UUID for userId, orderId, postId, etc
✅ Use item collection suffixes for related data: e.g. u#1234#posts, u#1234#orders, etc.
✅ Shard partition keys that get a lot of traffic: e.g. user#1234#shard1, user#1234#shard2, etc.
✅ Use unique IDs like UUID for userId, orderId, postId, etc
✅ Use item collection suffixes for related data: e.g. u#1234#posts, u#1234#orders, etc.
✅ Shard partition keys that get a lot of traffic: e.g. user#1234#shard1, user#1234#shard2, etc.
👉 Choosing a high cardinality (unique value) partition key will distribute the load evenly.
👉 Choosing a hot key (too common) creates bottlenecks and uneven capacity usage.
👉 Choosing a high cardinality (unique value) partition key will distribute the load evenly.
👉 Choosing a hot key (too common) creates bottlenecks and uneven capacity usage.
💡 Think of it as a hashing function:
DynamoDB takes the value of the partition key, hashes it, and maps it to a partition in its storage system.
💡 Think of it as a hashing function:
DynamoDB takes the value of the partition key, hashes it, and maps it to a partition in its storage system.
1. Understand your app's data access patterns
2. Model data based on these access patterns
3. Write queries to satisfy these specific access patterns
1. Understand your app's data access patterns
2. Model data based on these access patterns
3. Write queries to satisfy these specific access patterns
This can feel unintuitive at first but it results in ultra low latency queries with predictable performance.
This can feel unintuitive at first but it results in ultra low latency queries with predictable performance.
DynamoDB on the other hand is schema-less and designed for speed at scale.
DynamoDB on the other hand is schema-less and designed for speed at scale.
I offer 15-minute consultations that can help you change this.
Message me now, and let's talk.
I offer 15-minute consultations that can help you change this.
Message me now, and let's talk.
If you have a lot of relational data, the single table design is a must use.
You can retrieve multiple items with a single query.
Learn how to design it if this is your case.
If you have a lot of relational data, the single table design is a must use.
You can retrieve multiple items with a single query.
Learn how to design it if this is your case.