Image for post
Image for post

Things you should consider before using DynamoDb

本文設有中文版

Image for post
Image for post
Logo of AWS DynamoDB

No empty strings

DynamoDB is a NoSQL database, but it cannot store empty strings. Not in any levels of your JSON object. If you have a single value which is an empty string in your object, DynamoDB throws an error.

Query operation size limit

DynamoDB can maximum return 1MB of data in one query/scan operation. If your query contains more data, the results would include a key last_evaluated_key that you need to include in the next query, in order to retrieve “next page” of data.

Batch write limit

In every write requests, you can maximum include 25 rows only, which is very inconvenient. To deal with this issue and handle the possible write failure due to the exceed of throughput in concurrent write operations in multiple nodes, I have to do it like this:

Counting number of rows in a table

In other databases, there should be simple APIs to count the number of rows in a table, but not in the case of DynamoDb. There are two ways to get the number of rows in a table:

Conclusion

DynamoDB is powerful, but it definitely got some trade-offs. If you come from the world of other NoSQL databases like MongoDB, make sure you take the above points into consideration before switching.

A JavaScript/Node/Flutter developer who love technical stuffs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store