Reputation: 1322
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?
Upvotes: 3
Views: 3153
Reputation: 7132
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. I'm not 100% sure but I think Query
requests can only be worked on a single partition at a time. 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.
Upvotes: 3