Hacker News new | ask | show | jobs
by baix777 1912 days ago
The relative performance of these two queries will vary by data volume. Swap in a sales table for the weights table, and make that a massive sales table at that, joining it to much smaller prices can be much faster than a group by. Stated differently, a join can be faster than a group by. This is even more true when the small table can fit into memory and a hash join can be used, and the data in the group by can't fit into memory.
1 comments

Yes I'd say that I would intuitively do that only if the tables were both sufficiently large.

I assume somewhere there is a similar assumption in TFA.