[英]DynamoDB query & partition keys, simple question
something I don't understand about querying a dynamoDB table is that it seems necessary to include something like .withKeyConditionExpression("itemId = :v_id")
, but since the partition key uniquely identifies all items in the table, wouldn't you always be searching just one result? 对于查询dynamoDB表,我不了解的地方似乎是需要包含类似.withKeyConditionExpression("itemId = :v_id")
,但是由于分区键唯一地标识了表中的所有项,因此您不会总是仅搜索一个结果?
Trying to do something like: 尝试做类似的事情:
val expression = DynamoDBQueryExpression<PluginItem>()
.withKeyConditionExpression("itemId > 0")
.withFilterExpression("attributes.item_modification_date < :val1")
.withExpressionAttributeValues(eav)
val paginatedResults = queryByExpression(expression)
I'm looking to query and paginate 100,000 items in the table, can anyone point me in the right direction? 我正在查询表中的100,000个项目并对其分页,有人可以向我指出正确的方向吗?
partition key uniquely identifies all items in the table 分区键唯一标识表中的所有项目
so this isn't accurate. 所以这是不准确的。 It depends on your table design. 这取决于您的桌子设计。 However, you will get a lot more fexibility if you design a table with a ParitionKey and a Sort Key. 但是,如果设计具有ParitionKey和Sort Key的表,则将具有更多的灵活性。 That said, back to your statement. 就是说,回到您的声明。 A Primary Key not a partition key uniquely identifies an item in the table. 主键而不是分区键唯一地标识表中的项目。 A primary key is a combination of ParitionKey + SortKey(also known as Range Key). 主键是ParitionKey + SortKey(也称为范围键)的组合。
Think of each partition as a bucket. 将每个分区都视为一个存储桶。
withKeyConditionExpression("itemId > 0") withKeyConditionExpression(“ itemId> 0”)
this won't work. 这行不通。 You can't do those kinds of operations on a partition key. 您不能对分区键执行这些类型的操作。 However, you can do those kinds of conditions on a sort key. 但是,您可以在排序键上执行这些条件。
a video from 2018 - re:Invent that helped me get a better understanding of Dynamo. 来自2018年的视频-re:Invent帮助我更好地了解了Dynamo。 I have watched that video quite a few times, especially the last 30 to 20mins of it. 我看了好几次视频,尤其是最后30到20分钟。
Hope that helps. 希望能有所帮助。 I have only been working with dynamodb for a few months and there is so much more I have to learn. 我仅与dynamodb一起工作了几个月,还有很多东西我需要学习。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.