bin*_*les 5 adjacency-list amazon-dynamodb
我试图更好地理解在 AWS DynamoDB 中使用邻接列表模式进行多对多 (m:n) 关系设计。
查看此处的 AWS 文档: https: //docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-adjacency-graphs.html我们有一个示例,其中发票和账单实体具有 m:n 关系。
I understand that I can get details of all bills associated with a particular invoice by reading a single partition. For example I can query for Invoice-92551 and know some attributes of the 2 bills that are associated with it based on the additional items in the partition.
My question is what do I have to do to get the full bill attributes for these 2 bills. Does this require 2 additional queries using the IDs I derived from the invoice partition, or is there some other pattern I am missing here?
Additional Details Referencing the 2 different descriptions of Bill items in the screenshot:
Does this mean that my Invoice partitions should include any Bill attributes I want to access via minimal queries? I was originally thinking the Bill partitions would contain most of what I want, but that doesn't quite make sense if I want to get at them by Invoice.
不,没有额外的查询 - 除非您仅询问(“项目”)某些属性,否则您的查询将检索帐单的所有属性及其密钥。
DynamoDB 将每个分区一起存储在单个节点上,因此可以高效地获取整个分区。该分区由其“分区键”(您的发票号码)定义。该分区包含一堆“项目”(您的账单),每个项目都有自己的“排序键”(您的账单 ID)和任意数量的“属性”。当 DynamoDB 读取分区时,它会按顺序读取这些项目及其所有属性,并且可以返回所有这些项目,除非您明确要求它不要这样做。请注意,即使您只要求它返回这些属性的子集(“投影”),Amazon 仍然需要从磁盘读取它们,并且您仍然需要为此 I/O 付费。
| 归档时间: |
|
| 查看次数: |
1652 次 |
| 最近记录: |