Following up on my previous article about Sugar’s Team Security implementation, I thought it would be interesting and useful to discuss and mention a new setting to improve it.
For this article I’ve used:
- Sugar Enterprise v184.108.40.206
- The infrastructure setup described on my previous article Setup a Debian Based Sugar development environment (or similar)
- In-memory caching is enabled using memcache/memcached (my current preference) depending on the linux flavour used
Some time ago, I was analysing the performance of the Team Security query. The slowest part of the query seems to be caused by the subquery with joins between the tables team_sets_teams and team_memberships within listview queries.
Then I thought: Sugar caches most of the semi-static data (vardefs, language files, etc) into whatever caching mechanism is used by the system, why don’t we run an IN() condition using the cached list of ids per user, instead of a subquery on every listview load?