Closed hamzabinamin closed 6 years ago
@tmc @jhansche @lacker @hramos @noughts
Closing as unrelated to the php SDK.
Please don’t at people like that this is rude and un welcomed.
Check your indexes in your database and your slow queries in mongodb.
@flovilmart I'm sorry for tagging everyone but I submitted a thread a month back and no one relied on that.
I know this isn't a bug bug I would like to know what's the best way to retrieve data from a relation in a situation like this?
Nobody replied likely because this is not a bug.
You should really consider stackoverflow or stackexchange for those questions.
Last thing, check your indexes
Issue Description
~~ Please put your description here. Also indicate what's happening vs. what you expect to happen ~~
I have two tables named as Ingredient and Amount. Each ingredient has a relation column called amounts, that can either contain one or more than one amount objects. What I am trying to do is to fetch all ingredients in a loop and then fetch the amounts for all of those ingredients as well. However I have noticed that fetching amounts like that inside a loop slows down fetch a lot and I am not able to get results quickly.
As a reference I have 900+ ingredients and the server times out if I fetch all of the 900 ingredients, even if I fetch around 200, it takes around 2 minutes and 14 seconds to fetch them all with their amounts. Is there a way that I can fetch all the amounts for a certain ingredient without doing a second for-loop? Ultimately what I would want is to return all ingredients along with the amounts that they have.
Here's the code