News for hackers. Stuff that matters.
Re:The Set data structure saved me from a world of pain by afandian on Sunday October 18, 2020 @03:57PM (#24820607)
Surely a SQL query with SELECT, COUNT and GROUP would be simpler (and give you all counts for the given user in one go). It would also be faster to implement reliably, faster to run, more scalable and more maintainable.

This solution requires an extra instance of Redis in addition to a SQL db (which I assume is already in the mix), and has the potential for consistency drift.

And SQL is a very close cousin of set theory.

Re:The Set data structure saved me from a world of pain by root993 on Tuesday October 20, 2020 @06:39AM (#24835840)
For a very large database where the count would be filtered based on status of the conversations and running this query for every single support channel would be expensive would it not?
Re:The Set data structure saved me from a world of pain by afandian on Tuesday October 20, 2020 @11:16AM (#24838299)
Probably less expensive than Redis.

Given that the SQL approach is the standard one, I'd personally expect load testing to demonstrate that it didn't scale before doing something unusual.