Aggregate List Optimizations

0
In a microflow, when you retrieve a list and immediately follow up with an aggregate list operation, Mendix optimizes these two activities by merging them into one action (provided the list is not used later on in the flow). However, what I cannot find in the documentation, is whether there is a difference in retrieving the list over association versus database. Does anyone know if retrieving via association/database matters for the optimization of the aggregate list? Thanks!
asked
2 answers
2

For anyone who is curious to know the full answer. I have asked Mendix this question via a support ticket, as I was still unsure whether or not the optimization is done for lists retrieved via association. Their reply was as follows:

 

It seems that if retrieve by association is selected. the optimization does not take place. 
 
Let's see this example with a Main entity and a Sub entity, where Main is associated one-to-many to Sub. If one Main object is retrieved, and then retrieve by association, in the debugger we see the related Sub entities are retrieved and thus there is no optimization taking place. Please note that if there would be an optimized query, would not be visible, as they are not retrieved, as the Sub list would only be counted (see screenshot below)
 

 

They have also adjusted the documentation, s.t. it now says: “a database Retrieve activity is only used once in one Aggregate list activity”.

answered
0

The retrieve over association should be faster but the same optimization will be done. So I would do the retrieve over the association.

 

Regards,

Ronald

 

answered