Don't get me wrong, I love Postgres and use it in pretty much all of my projects... but for this kind of application it's not very well suited. Leave your relational data for the database and use something more efficient!<p>Redis comes with both bitfields (see <a href="http://redis.io/commands/bitcount" rel="nofollow">http://redis.io/commands/bitcount</a>) and hyperloglog counters (see <a href="http://redis.io/commands/pfcount" rel="nofollow">http://redis.io/commands/pfcount</a>), requires almost no setup and has very minimal overhead.