Optimize Microflow Aggregates VS Retrieve first

2
I was wondering what is the most optimal microflow? My goal is to know if a list of of retrieved objects is empty Option 1: Retrieve first and then check if object is empty Option 2: Retrieve, then count, then check if count is 0 (https://docs.mendix.com/howto/logic-business-rules/optimizing-microflow-aggregates)   Thanks in advance,   Nick Kluter
asked
3 answers
4

You can get the best performace by doing a Retrieve with limit 1 and then a Count.

(If this is not just an esoteric question and you really have performace issues: consider using indexes!)

 

answered
2

Are you doing anything else but counting, once you know the list is not empty? If so, you should just retrieve and check for empty. Else I would say counting is more optimized, since the query will result in a count-only and not retrieve the actual objects.

answered
1

Fabians method is also a suggestion from Mendix that you can find in the Academy courses. If you haven't done the courses, I would suggest you to watch them.

answered