Use SQL subqueries to count distinct 50x faster
I find it disapointing that the optimizer of the database is not able to get to the fastest result by itself.A broken promise of declarative languages I guess.