Performance of Associations in Microflow Expressions
Good Morning, Mendix 8.10 has this nice feature, where I can use associations in microflow expressions without the need of retrieving the other object. I wonder how this affects the performance of my application. My guess is, that mendix is doing some sort of retrieve if I just use one attribute once. But what happens if I need multiple attributes of the same object but in different actions? Will Mendix know that and optimize it to only retrieve the object once? If not, it might have an impact on my performance. Another question is: Will Mendix do a retrieve from the database or will it try to use cached data via association? This might lead to different solutions, depending on the current status of the used object. Does anybody have some more insights? Here are the release notes of this feature: https://docs.mendix.com/releasenotes/studio-pro/8.10#associations-in-microflow-expressions PS: I selected Studio Version 8.9 because 8.10 is not existing in the selection.
The semantics of retrieve over association in an expression is the same as for Retrieve over association activity. That is – it retrieves object from cache when available. It also retrieves a full object and puts it into the cache, so that if you use long expressions elsewhere (e.g. to get to another attribute of the same object), that comes without any extra overhead.
I did a test for the Cache vs DB Question. I created two Entities. Master is associated with Slave. Slave has a boolean attribute. In the first microflow, I change the boolean attribute but don’t commit it. In the submicroflow, I first use the association in the split and then do a retrieve by association and another one by DB. I can see, that the split result is showing the cached version and not the DB version.
But since it is not documented, I don’t know if it always acts this way.