AWS Database Blog

Resolve to follow Amazon DynamoDB best practices in 2019

We recommend that you follow Amazon DynamoDB best practices in 2019 to help you maximize the performance and optimize the costs of your mission-critical workloads when working with DynamoDB. This post highlights DynamoDB content that will help you keep such a resolution.

The primary key that uniquely identifies each item in a DynamoDB table can be simple (a partition key only) or composite (a partition key combined with a sort key). Design your application for uniform activity across all logical partition keys in your table and its secondary indexes. Though this is a NoSQL best practice, you get the added benefits of burst capacity, adaptive capacity, and write sharding.

In a DynamoDB table, the primary key that uniquely identifies each item in the table can be composed not only of a partition key, but also of a sort key. Well-designed sort keys gather related information together in one place where it can be queried efficiently. Composite sort keys let you define hierarchical (one-to-many) relationships in your data that you can query at any level of the hierarchy.

Secondary indexes are often essential to support the query patterns that your application requires. At the same time, using secondary indexes inefficiently can add cost and reduce performance unnecessarily.

DynamoDB currently limits the size of each item that you store in a table. If your application needs to store more data in an item than the size limit permits, you can try compressing one or more large attributes or breaking the item into multiple items (efficiently indexed by sort keys). You also can store the item as an object in Amazon S3 and store the Amazon S3 object identifier in your DynamoDB item.

General design principles in DynamoDB recommend that you keep the number of tables you use to a minimum. For most applications, a single table is all you need. However, for time-series data, you can use one table per application per period.

Adjacency lists are a design pattern that is useful for modeling many-to-many relationships in DynamoDB. More generally, they provide a way to represent graph data (nodes and edges) in DynamoDB.

In some circumstances, migrating from one or more relational database management systems (RDBMSs) to DynamoDB might not be advantageous. In these cases, it might be preferable to create a hybrid system.

When your business requires low-latency response to high-traffic queries, taking advantage of a NoSQL system generally makes technical and economic sense. DynamoDB helps solve the problems that limit relational system scalability by avoiding them.

Follow these tips about when to scan versus when to query and how to take advantage of parallel scans.

DynamoDB global tables provide a fully managed solution for deploying a multiregion, multimaster database without having to build and maintain your own replication solution. When you create a global table, you specify the AWS Regions where you want the table to be available. DynamoDB performs all of the necessary tasks to create identical tables in these regions and propagate ongoing data changes to all of them.

Adhere to DynamoDB best practices this year for the best performance and lowest costs. If you have questions or feedback about DynamoDB best practices, see the DynamoDB forum.


About the Author

Craig LiebendorferCraig Liebendorfer is a senior technical editor at Amazon Web Services.