5 ms·
The article said they could rebuild the count if they needed to. So something in regards to each click is being stored. If you were using postgres you'd just
by mbell 14y ago
The article said they could rebuild the count if they needed to. So something in regards to each click is being stored. If you were using postgres you'd just setup a trigger on that table to increment the click values (stored in another table) as appropriate. No aggregate function needed.
- samstokes 14y agoCertainly you can implement this same pattern without Redis. Triggers in Postgres would be a reasonable way to do it. I didn't say you can't do this in Postgres, I said you can't do it with COUNT(). It does indeed sound like they're storing every click: that's precisely why using aggregate functions would be expensive.
- guywithabike 14y agoYou absolutely can do it without COUNT. Just increment a counter value, the same way they're doing it in Redis.
- pestaa 14y agoWhy was this downvoted? Adding 1 to any number field is just as an atomic operation as incrementation is in Redis.
- samstokes 14y agoPresumably it was downvoted (not by me) because it's refuting a claim I didn't make: samstokes: I said you can't do it with COUNT() guywithabike: You absolutely can do it without COUNT Then we agree.