graph-gophers / dataloader

Implementation of Facebook's DataLoader in Golang
MIT License
1.2k stars 75 forks source link

How do dataloaders solve the 1-to-many relationship? #71

Open barneylvlin opened 3 years ago

barneylvlin commented 3 years ago

We have two modules, one is the order and the other is the sub order. When querying the order list, you don't need to worry about the "n + 1" problem, but if you check the sub order according to the order list, there will be problems. For example, if a order corresponds to multiple sub orders, you need to query the sub order details once every time.

Now using dataloader cannot solve this 1-to-many relationship, because the data will be disordered.

nicksrandall commented 3 years ago

I'm not sure I fully understand the issue. If you still have this question, could you please elaborate?