How to reduce database calls (associations) on page?

Hi, I have a page with a DataView which has a ListView inside it. Inside this ListView I have GroupBoxes which have a few Reference Selectors each (via Associations & non editable) inside. Once I have around 100 List items, the page loading speed decreases drastically (around 10-30sec). I think this is because of the many associations that are calling the database. Do you have any best practices/tricks on how to reduce the database calls on a page (for the associations)? Thanks a lot. Best, Peter
4 answers


  • When there are lot of associations, the query generated is always complicated which causes delay in execution. you can debug this and check how much time it takes. If the levels of association is very deep then it will be even worse. So you might have to work on refactoring your domain model.
  • A better approach was to look at how you can denormalizing your domain model.
    • What Erwin suggested already is something similar, although filling those attribute when loading the page will cost you the same time. Meaning there wont be any drastic increase in what you might already have. 
    • And given you are using reference selector which could have a possibility to grow exponentially, not sure how much you could extend your current domain model with those kind of attributes.
    • Once again as Erwin said, it hard to provide any suggestions here without proper understanding of your existing domain model and together with the volume of the data you are dealing with. 
  • Also consider if you really need to show 100 items – reduce the page limit

Not being familiar with your domain model this might  or might not be an option for you.

In some case we prevent the association calls by creating some display attributes for values that otherwise need to be retrieved over association. This will help in the performance of the grid/ listview. It does however increase the complexity of your domain model and adds redundancy and the need for data updates. Depending on your situation this might be a possible route. Another might be redesigning your model for this purpose, but without further information on the model I can not provide any answer here.


Upto Mendix version 7.something (7.8 I believe) the reference selector for non-editable attributes did retrieve its list of values. These values are never used since the attribute is non-editable. So if you are still on a low 7 version, upgrade will improve the performance for your page by the amount of time that it currently takes to do the retrieve of the reference selectors. 


Thanks for your quick answer Erwin,

Most of the associations are going from one Entity to different other Entities and offer Reference Selectors. There is also another ListView inside the ListView on that page (also read only).

To properly understand your approach: For the main entity (from which the associations originate on that page), you would add additional attributes that store all the ReadOnly data I currently collect via the Associations fetch? Would you create these attributes within the main entity or create 1 new entity over 1 association for it?

And when would you populate these new “display attributes”? When opening the page via a microflow? Do I need to “commit” them or do you think it would be enough to just leave them in memory?

Thanks a lot for sharing possible solutions.