mac-r
mac-r

Reputation: 3

Multiple sorted sets in Redis

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)?

Upvotes: 0

Views: 466

Answers (1)

FGRibreau
FGRibreau

Reputation: 7229

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.

Upvotes: 1

Related Questions