DigiNews

Tech Watch by Johan Denoyer

← Back to articles

The DISTINCT in your COUNT

Quality: 7/10 Relevance: 9/10

Summary

The article analyzes how PostgreSQL handles COUNT(DISTINCT) and why it typically fails to parallelize, illustrating a serial plan due to the need to deduplicate across workers. It demonstrates a parallelizable rewrite using GROUP BY to push the distinctness into a form that benefits from parallel execution, with performance comparisons and practical guidance. It also touches on approximate methods like HyperLogLog for large-scale dashboards.

🚀 Service construit par Johan Denoyer