I have an aggregate used inside the loop circle. That aggregate is just added to know if the particular record exists in the database. But in AI Mentor studio I am getting a performance issue that aggregate present in loop cycle. What is the best approach to resolve this issue.?
Should I use getAction instead of aggregate?
Hi Neha Sheikh,Have you followed the "How to Fix" section? + Get all your data you need at once, before the loop, then use your logic to handle the business flow. (recommended)+ Cache this in a function GetMovieById (not recommended because you still have to call the database more than one)Without more context, I can't help you further because it may cause other issues.If it can help you solve the problem, that's good. Ideally, we don't want to have tech debt in our application. Reality, it is unavoidable. AI Mentor studio helps you to lower your debt. Sometimes, in order for your application to work properly, we must trade with performance. It's a trade-off.Regards,Nam
Hi Neha,
OutSystems suggest not to use aggregate in a loop and get the data before the loop joined with table.
lets say you are are getting movie list first and looping movie to get the movie details.
so you should replace the movie aggregate by joining the movie with movie details joined on the movie Id and avoid inner aggregate.
Regards,
Shoeb