5 ms·
> I'm not sure I understand how a JOIN would have fixed this problem If the set of things in A that have ids in B is very small, then very little data is retur
by mijoharas 4y ago
> I'm not sure I understand how a JOIN would have fixed this problem
If the set of things in A that have ids in B is very small, then very little data is returned from the JOIN query, while a lot may be returned from the B query by itself.
(if that set of things is large, then you'll still want to batch the joined query as well, i.e. using find_each in rails. They're orthogonal requirements)
- nightpool 4y agoSure, I mentioned this in my comment as well, but I think it's clear from the use-case of the article that the cardinalities of the two tables are approximately the same.