7 ms·
The DISTINCT in Your COUNT
- muth02446 1mo agoIf 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_algorithm 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.
- esafak 1mo agoAPPROX_COUNT_DISTINCT / APPROX_DISTINCT https://www.sketchingbigdata.org/ https://www.sketchingbigdata.org/
- thecaio 1mo agoHard to make a case to engange with an AI written article even if not fully slop
- nh23423fefe 1mo agoSo don't engage and be silent. What value is "I'm obsessed with telling everyone i hate llms" for the billionth time?
- anon48293 1mo agoSo I don’t waste my time reading it.
- natmaka 1mo agoIn the same vein: https://www.snowflake.com/en/blog/engineering/postgres-count-distinct-approximation/ https://www.snowflake.com/en/blog/engineering/postgres-count...
- wodenokoto 1mo agoI 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.