AWS DynamoDB并将用户数据存储在一个表中
我正在寻找将用户数据与订单和发票等交易数据一起存储的方法。通常,我会使用诸如PostgreSQL之类的关系数据库,但是我想知道将用户数据及其交易数据一起存储在一个NOSQL表中,这是一个好主意吗?
我假设如果您这样做,则将数据构建以使用对象或数组存储订单或发票,但是我不确定这是最好的。
编辑
因此,在进行了更多研究并尝试了解如何将所有内容放入单个桌子设计之后,我发现文章在AWS文档中。我决定使用主键和排序键的组合将数据组织到集合中。排序密钥用于确定集合(即订单,客户数据等)。该解决方案非常适合我的用例,因为我可以将所有用户数据(包括订单之类的交易)放在一个DynamoDB表中。
I am looking at ways to store user data alongside transactional data like orders and invoices. Normally, I would use a relational database like postgresql, but I wanted to know if it would be a good idea to store the user data along with their transactional data in one noSQL table like DynamoDB?
I would assume if you did that you would structure your data to either use objects or arrays to store the orders or invoices but I'm not sure if that is the best was to go about it.
EDIT
So after doing some more research and trying understand how to fit everything into a single table design I found this article in the AWS documentation. I decided to organise my data into collections using a combinaton of the primary key and the sort key. The sort key is used to determine collections (i.e., orders, customer-data, etc). This solution is perfect for my use case because I can keep all the user data (including transactions like orders) in one dynamodb table.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简而言之,不要那样做。 DynamoDB是一个很棒的工具,但是您需要先了解它。它不仅是无sql,而且还是分布式的。它提供了出色的性能,可扩展性和定价。但是建模更棘手。您无法根据需要构建请求,在设计模型时必须考虑这些请求。阅读有关查询与扫描和全球与本地索引的信息。当您知道时,您可能会尝试阅读有关单桌设计的信息。它应该让您了解DynamoDB的局限性。
In short, don't do that. DynamoDB is a great tool, but you need to understand it first. It's not just a no-sql, it's also a distributed one. It gives great performance, scalability and pricing. But modeling is trickier. You can not build requests as you please, those has to be taken into consideration when you design your model. Read about queries vs scans and global vs local indexes. When you get that you might try reading about Single Table Design. It should give you an idea about the limitations of the DynamoDB.