0
votes

There are many accounts, which get events (data points with timestamps) stored in realtime. I discovered that it is a good idea to store events using a sorted set. I tried to store events for multiple accounts in a one sorted set, but then didn't figure out how to filter events by account id.

Is it a good idea to create multiple sorted sets for each account (> 1000 accounts)?

1
Yeah, that works well, but I am not sure that this is the best practice - mac-r

1 Answers

1
votes

Questions:

  • How long will you keep these events in memory ?
  • Your number of accounts won't grow ?
  • Are you sure you will have enough memory ?

... but yes, you should definitely create a sorted set for each account, that's the state of art when using Redis.

However, if it's all about real-time events (storing and retrieval) you may want to give a try to a database like InfluxDB that provides a powerful SQL-like query system. It seems a better answer to your problem.