Live data from Hacker News

Making Postgres Bloom

pipelinedb.com

21–25 of 25 posts

Re: Making Postgres Bloom

#21
post #15

Earlier quoted context omitted.

It probably uses a HyperLogLog--the 2% error rate kind of gives it away. Bloom filters approximate set membership queries, HyperLogLogs approximate set cardinality queries. COUNT DISTINCT is a set cardinality query. We actually support a HyperLogLog backed COUNT DISTINCT aggregate too: http://docs.pipelinedb.com/aggregates.html#general-aggregate...

Consider my metaphorical hat eaten. Thanks for the cool tools! I'm currently working with Postgres and this looks like a great thing to add to the mix.

There's a postgres extension that implements hll for postgres. Rather useful: https://github.com/aggregateknowledge/postgresql-hll

Re: Making Postgres Bloom

#22
post #11
post #5

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! Redis comes with both bitfields (see http://redis.io/commands/bitcount ) and hyperloglog counters (see http://redis.io/commands/pfcount ), requires almost no setup and has very minimal overhead.

Classic premature optimization. "Just add another database!"

From the article:

> Some of you, who have ventured deep into the bowels of databases, will probably point out that doing something like this in a real setup is committing concurrency suicide. All updates to the same row will essentially be executed serially which is no bueno if you're trying to build a performant data pipeline.

Re: Making Postgres Bloom

#23
post #11
post #5

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! Redis comes with both bitfields (see http://redis.io/commands/bitcount ) and hyperloglog counters (see http://redis.io/commands/pfcount ), requires almost no setup and has very minimal overhead.

Classic premature optimization. "Just add another database!"

[deleted]

Re: Making Postgres Bloom

#24
post #11
post #5

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! Redis comes with both bitfields (see http://redis.io/commands/bitcount ) and hyperloglog counters (see http://redis.io/commands/pfcount ), requires almost no setup and has very minimal overhead.

Classic premature optimization. "Just add another database!"

"Let's not over-engineer though."

Implements bloom filters

Re: Making Postgres Bloom

#25
post #8

The example doesn't quite make sense: SELECT user_id IN (SELECT DISTINCT user_id FROM user_actions); is not valid SQL. You may mean something like: SELECT 123 IN (SELECT DISTINCT user_id FROM user_actions); which is a strange query, as it's equivalent to: SELECT 123 IN (SELECT user_id FROM user_actions);

Wouldn’t

  SELECT EXISTS (SELECT 1 FROM user_actions WHERE user_id = 123);
lead to a better execution plan?
Post reply on HN