Follow-up pass group IDs as a subquery instead of loading them into memory
Follow-up from !49012 (comment 466059814)
The queries look good. But I'm surprised we load the group ID into memory to pass them to another query instead passing them as a subquery.
I did some digging, and it seems we ended up here in a few iterations (pun intended): !36766 (merged) and !44685 (merged). I'm surprised these never seems to have gotten a database review, where I think it would have been better if we had.
Now for this MR, I don't want to block it on this, because these queries are around for a while already.
Investigate if we can pass group IDs as a subquery instead of loading them into memory in order to pass them to another query.