First, you need to determine the level of precision you need to query by. In the following example, it ends up being timeboxed into 10 second bins, but in groups of 100 different entities (or meters in this example):
Then, answering a query like:
Give me <45 minutes> worth of data from <18 hours ago> for entities <1, 2, 226, 301>
Ends up being an aggressive fetch (light pink):
And then a filter against that data within the application code:
Riak handles a large number of keys (billions) pretty well. Things like expiration windows (which are built into Bitcask) can aid in keeping the number of keys managable too.
Shout out to Dietrich Featherston and his presentation on Kobayashi at Boundary.