[Vtigercrm-developers] performance when using custom sharing rules
Alan Bell
alan.bell at libertus.co.uk
Thu Sep 17 11:19:01 GMT 2015
Hi all,
if you have a bunch of custom sharing rules (about 20 role to role
rules) and a bunch of users (I have about 150) you will find that
recalculating the sharing access is quite slow and logging on for the
first time takes a while after the dialog asking for your language and
date format preferences. This is because it does a *heap* of work to
recalculate the user_privileges/sharing_privileges_$id.php file, or
specifically after it does that it populates the vtiger_tmp_* tables
with a load of stuff defining the relationship of your user to every
other user and role combination. It does an astonishing number of inserts.
To fix this, you can wrap the population of the temporary tables in a
transaction, by editing modules/Users/CreateUserPrivilegeFile.php and
looking around line 390 and putting a start transaction and complete
transaction around the populateSharingtmptables command, so it looks
like this:
//Populating Temp Tables
$adb->startTransaction();
populateSharingtmptables($userid);
$adb->completeTransaction();
and that will make first logon pretty much instant.
Alan.
More information about the vtigercrm-developers
mailing list