You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I originally wrote this codebase, MongoDB didn't have a built-in way to do graph traversal so my solution was to use a loop (originally, recursion), see https://github.com/amoeba/treestats.net/blob/main/helpers/chain_helper.rb#L68. The problem with this is that it's slow and scales poorly: We issue a query for each node in the tree which hammers the database and can take many seconds to finish.
Since MongoDB 3.4, the $graphLookup aggregation stage seems like it can do this all for us in one query which should be orders of magnitude faster.
The text was updated successfully, but these errors were encountered:
When I originally wrote this codebase, MongoDB didn't have a built-in way to do graph traversal so my solution was to use a loop (originally, recursion), see https://github.com/amoeba/treestats.net/blob/main/helpers/chain_helper.rb#L68. The problem with this is that it's slow and scales poorly: We issue a query for each node in the tree which hammers the database and can take many seconds to finish.
Since MongoDB 3.4, the $graphLookup aggregation stage seems like it can do this all for us in one query which should be orders of magnitude faster.
The text was updated successfully, but these errors were encountered: