Quantcast
Channel: Enrico Simonetti [dot com] » MySQL
Viewing all articles
Browse latest Browse all 3

SugarCRM – Team security query caching

$
0
0
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. Prerequisites For this article I’ve used: Sugar Enterprise v7.6.0.0 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 Introduction 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? Basically we would want to change a listview query from something like this (let’s call this “Query A“): SELECT ... FROM contacts INNER JOIN (select tst.team_set_id from team_sets_teams tst INNER JOIN team_memberships team_memberships ON tst.team_id = team_memberships.team_id AND team_memberships.user_id = 'seed_will_id' AND team_memberships.deleted=0 group by tst.team_set_id) contacts_tf ON contacts_tf.team_set_id = contacts.team_set_id LEFT JOIN […]

Viewing all articles
Browse latest Browse all 3

Trending Articles