3 ms·
If you like to jump to the comments before reading the post (like me), this is an exploration of a fairly common situation: calculating the total number of peop
by kiwicopple 4y ago
If you like to jump to the comments before reading the post (like me), this is an exploration of a fairly common situation: calculating the total number of people who have "viewed/seen" a blog post.
tldr: use either Use HyperLogLog [0] (if you can install extensions on your postgres database), or hstore[1] if you can't.
HyperLogLog is a probablistic data structure, which can "estimate" the number of viewers, so it scales very well for Twitter/FB-scale platforms.
[0] HyperLogLog: https://en.wikipedia.org/wiki/HyperLogLog https://en.wikipedia.org/wiki/HyperLogLog
[1] hstore: https://www.postgresql.org/docs/current/hstore.html https://www.postgresql.org/docs/current/hstore.html