简体   繁体   English

在 DynamoDB 中存储时间序列数据

[英]Storing time series data in DynamoDB

We are collecting time series events for users and need to be able to query over a time range.我们正在为用户收集时间序列事件,并且需要能够在一个时间范围内进行查询。 An example row might be:一个示例行可能是:

{ user_id: 100, timestamp: 1352293487, location: "UK", rating:5 }

We need to be able to query over a time range based on the timestamp for a particular user.我们需要能够根据特定用户的时间戳在一个时间范围内进行查询。 Would I be correct in thinking we could utilise DynamoDB's Query operation and set the user_id to the primary key, timestamp to the range key in order to efficiently query between two timestamp values?我认为我们可以利用 DynamoDB 的 Query 操作并将 user_id 设置为主键,将时间戳设置为范围键以便在两个时间戳值之间进行有效查询是否正确?

Your suggestion sounds like a good schema as long as there are enough users.只要有足够的用户,您的建议听起来就是一个不错的模式。

As you know, Amazon automatically spread your tables over partitions for reliability and performances.如您所知,为了可靠性和性能,Amazon 会自动将您的表分布在分区上。 I'm not 100% sure but I think Query requests can only be worked on a single partition at a time.我不是 100% 确定,但我认为Query请求一次只能在一个分区上工作。 This matters because the provisioned throughput is evenly split over these partitions meaning that frequent queries on the same item will only use a fraction of what you provisioned.这很重要,因为预配的吞吐量在这些分区上平均分配,这意味着对同一项目的频繁查询将仅使用您预配的一小部分。

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

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