Why use $group / group_by instead of multiple requests?
0
votes
1
answer
48
views
Let's suppose that there are 100 types of dogs scattered across the documents of my collection. If I need to group by types of dogs and then compute some aggregate statistic about each type of dog, why perform a query involving
$group
, which in principle processes each document sequentially, versus sending 100 separate, simultaneous queries to the database where each query filters based on the type of dog?
Wouldn't the 100 simultaneous, separate query be faster?
If it is faster, at scale, what is the drawback to not do it, if any?
Asked by Bear Bile Farming is Torture
(119 rep)
Sep 29, 2023, 01:56 AM
Last activity: Sep 29, 2023, 12:21 PM
Last activity: Sep 29, 2023, 12:21 PM