Optimize retrieves in expressions - Mendix Forum

Optimize retrieves in expressions

25

In general, I recommend to never execute retrieves in expressions. The example below, a customer is linked 1-1 with an address. It may seem like an innocent create variable, but actually does a data retrieve over association:

 

So mainly for maintainability, but also for performance reasons I would love to see this changed in Studio Pro.

Possible solutions:

Thanks for your vote!

 

image.png

asked
3 answers

In general this feature was wanted some time ago and I recall colleagues wanting this. The implementation is highly flawed though. In its current implementation it creates a mess; hidden logic and unexpected performance loss.

 

In hindsight this should be removed, so I agree

Created

Currently if you use the same object twice in an expression, Mendix will retrieve the object twice, so that means the performance is even worse than Johan's proposal. If you want to use multiple attributes in 1 expression: first retrieve the object, then create the expression based on the variable.

Created

I agree with you Johan.

 

If we use only one attribute in expressions, it is fine.

But what if when we use same entity with multiple attributes different times, then retrieving every time single attribute will definitely causes performance issues. Doesn't it?

Created