AnsweredAssumed Answered

Performance optimilization for relationships

Question asked by Jeroen Somhorst on Sep 4, 2019
Latest reply on Sep 4, 2019 by Jeroen Somhorst



we are currently in the process of finding a solution for some performance issues we face when working with SugarCRM. On my local development environment I try to add tags to 100 accounts. I do this by first creating a specific amount of tags in the database using the beanfactory ($bean = BeanFactory::newBean('Tags') ... etc) and after that adding the tags to the account using the load_relationship -> add method. Just plain SugarCRM logic. 


This is an 'empty' default sugar 8.0.1 instance that I've constructed. What I see is that it takes almost 700 milliseconds to create a single tag and another 400 milliseconds for adding that tag to the relationship between accounts -> tags. I was wondering if there are any steps I can undertake to improve the performance. From my research I already found out that it isn't better to just add the id's to the relationship->add() method because the link2 class will first fetch the entire bean because of logichook functionality. 


Another approach I thought about was adding the relationship myself to the tag_bean_rel table but this is something I want to prevent at all times because this means talking directly to the database and ignoring any business logic. As said this is a default 801 install so the main question here is: Are there any settings or code that I can use to increase performance while adding new records to the database and relate these beans to another records? Is there some sort of bulk method?