简体   繁体   English

对于 aws dynamodb,hash_key 的扫描是否使用索引?

[英]For aws dynamodb, does a scan of the hash_key use an index?

The hash_key takes the form of daily|<YYYY-MM-DD> . hash_key 采用daily|<YYYY-MM-DD>的形式。

Whats the most efficient way to fetch a range of dates?获取一系列日期的最有效方法是什么?

We cannot do a query.我们无法查询。 Well not for the whole resultset in one go. Although a loop and a series of queries for each exact key might be the 'correct' answer?好吧,对于一个 go 中的整个结果集来说不是这样。尽管对每个确切键的循环和一系列查询可能是“正确”答案? Is that the best solution?那是最好的解决方案吗?

If we do a scan on the hash_key, would it use an index?如果我们对 hash_key 进行扫描,它会使用索引吗? Would that actually be somewhat efficient?这实际上会有点效率吗? eg: hash_key in ('daily|2022-12-07', 'daily|2022-12-08')例如: hash_key in ('daily|2022-12-07', 'daily|2022-12-08')

The sort_key is a user identity_id. sort_key 是用户 identity_id。

Best approach is to do a query for each PK, possibly in parallel.最好的方法是对每个 PK 进行查询,可能是并行的。 If the average item collection size is large this is even pretty efficient.如果平均项目集合大小很大,这甚至非常有效。

Think of DynamoDB like a hashtable storing sorted lists.将 DynamoDB 想象成存储排序列表的哈希表。 You want all the values associated with certain hash table keys.您需要与某些 hash 表键关联的所有值。 So you need to do the lookups.所以你需要做查找。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM