The DISTINCT in Your COUNT
Posted by gmcabrita 10 hours ago
Comments
Comment by wodenokoto 1 hour ago
I don't understand the argument that COUNT(DISTINCT ...) cannot be parallelized, but you can count distinct values in parallel using COUNT(*) GROUP BY ...
But then again the article is being accused of heavy LLM. If you notice that COUNT(DISTINCT ...) doesn't parallelize and you ask an LLM to argue why, you get easily get an article without a good thread.
Comment by muth02446 10 hours ago
If you are satisfied with an approximation of "DISTINCT", there is a facinating
probabilistic algorithm by Flajolet and Martin
https://en.wikipedia.org/wiki/Flajolet%E2%80%93Martin_algori...
which fits on 10 lines and does not require sorting. Improved versions of it are LogLog and HyperLogLog.
Comment by esafak 9 hours ago
APPROX_COUNT_DISTINCT / APPROX_DISTINCT
Comment by natmaka 9 hours ago
In the same vein: https://www.snowflake.com/en/blog/engineering/postgres-count...
Comment by thecaio 10 hours ago
Hard to make a case to engange with an AI written article even if not fully slop
Comment by nh23423fefe 9 hours ago
So don't engage and be silent. What value is "I'm obsessed with telling everyone i hate llms" for the billionth time?
Comment by anon48293 14 minutes ago
So I don’t waste my time reading it.