Radim Marek: The DISTINCT in your COUNT
boringSQL | Supercharge your SQL & PostgreSQL powers
Radim Marek: The DISTINCT in your COUNT
COUNT(DISTINCT) has no combine function, so PostgreSQL can't merge per-worker results: the whole statement drops to one core and a disk-spilling sort. Push the distinctness into a GROUP BY instead and parallel query comes back.
0 comments
No comments yet.