accounts selection very slow

Hi,

The selection of thousands of accounts takes about 1 hour of time! This not happens during contacts selection. (see attached image)

Any ideas?

Regards

Hi,

Anyone else have this problem?

I don’t see slow query or other error. No idea. This occurs Only for accounts.

Regards

We have not run into this issue before, have you created any custom relationships ?

this is very odd to happen on one module but not another.

Ian.

Hi,

Thank you for your help.

Yes, I have created some many to many relationships, but then deleted. ( with also repair-> Rebuild Relationships ). Some debug-level log may help?

Hi Rossi,

yeah that might shed some light on the issue, it really is not normal we have worked client clients which have really large databases which are not seeing issues like this.

Ian.

Ok Ian,

Here (attached) some logs, truncated after a while…

Hi Rossi,

The only thing I can see there is the following lines keep showing up looks like these three are being run on the accounts list view just before you click on a accounts detail view. these look like they are taking longer to run than the rest and would be where I would start looking, I find it hard to believe that this would the cause of the issue mind you.

Fri May 30 15:48:41 2014 [14169][1][INFO] Query:SELECT category, name, value FROM config WHERE category = ‘jjwg’
Fri May 30 15:48:41 2014 [14169][1][INFO] Query Execution Time:4.4822692871094E-5
Fri May 30 15:48:41 2014 [14169][1][INFO] Query:SELECT id FROM outbound_email WHERE type = ‘system’
Fri May 30 15:48:41 2014 [14169][1][INFO] Query Execution Time:4.0054321289062E-5
Fri May 30 15:48:41 2014 [14169][1][INFO] Query:SELECT * FROM outbound_email WHERE id = ‘39088339-b522-e623-d9aa-53189b98d44b’

however running one of these queries on a instance I have here is given me Execution times of 0.0003 sec.

hopefully that does open a door to lookk at.

Ian.

Hi Ian,

Comparing the selection of 1 account to 1 contact, I 've noticed something weird in logs. It refers to
AccountsJjwg_MapsLogicHook::addRelationship $arguments: Array

And with my editor , I found in custom/modules/Accounts a file:

logic_hooks.php.

After commented out two lines:

//$hook_array[‘after_relationship_add’] = Array();

//$hook_array[‘after_relationship_add’][] = Array(77, ‘addRelationship’, ‘custom/modules/Accounts/AccountsJjwg_MapsLogicHook.php’,‘AccountsJjwg_MapsLogicHook’, ‘addRelationship’);

The problem is vanished.

Now my problem is that I’m not a php programmer and I’m a beginner, with suitecrm, so I’m not sure of this update.

Could you help me?

Hi Rossi,

Looking at this its to do with the maps modules, it wont do any harm having this commented out as long as you dont use the maps modules? as long as you dont I personally would just leave it commented out. holwever you are missing a bit in the code there. should look like this ? I am guessing that is what you ment ?

$hook_array[‘after_relationship_add’][] = Array(77, ‘addRelationship’, ‘custom/modules/Accounts/AccountsJjwg_MapsLogicHook.php’,‘AccountsJjwg_MapsLogicHook’, ‘addRelationship’);

The following line should be uncommented, It should not cause the issues that you are seeing but it is best to leave that uncommented.

$hook_array = Array();

back to the issue.

This must be to do with the amount of data on the accounts module. I have found another instance of this of which we found they did not use the maps so we removed the logic hook that you have commented out and also commented out the following in the same file.

//$hook_array[‘after_relationship_delete’][] = Array(77, ‘deleteRelationship’, ‘custom/modules/Accounts/AccountsJjwg_MapsLogicHook.php’,‘AccountsJjwg_MapsLogicHook’, ‘deleteRelationship’);

again as long as the maps module is not used this change will not affect anything and chances are improve speed when the database grows. more investigation would need to be done to get to the bottom of why this is happening.

having a quick look at the code for that it look slike it is updating the geocode information for each account when this is being called.which does explain why its taking so long to return anything for you. I cant explain why its being called on the list view of the module.

Ian.

1 Like

Hi Ian,

Thank you for your help.

Yes, It seems that these N+1 updates (in this case) come when an account is associated to a target list:

[…]
Tue Jun 3 15:20:58 2014 [15171][1][DEBUG] Hook called: ProspectLists::after_relationship_add
Tue Jun 3 15:20:58 2014 [15171][1][DEBUG] Hook called: Accounts::after_relationship_add
Tue Jun 3 15:20:58 2014 [15171][1][DEBUG] Creating new instance of hook class AccountsJjwg_MapsLogicHook without parameters
Tue Jun 3 15:20:58 2014 [15171][1][INFO] AccountsJjwg_MapsLogicHook::addRelationship $arguments: Array
(
[id] => 1125fc8b-3a59-d3c1-80c3-5368f884153a
[related_id] => d85d1e8e-b4c3-2e73-d0f3-538887b8bf93
[module] => Accounts
[related_module] => ProspectLists
[related_bean] => ProspectList Object
(
[field_name_map] => Array
(
[…]

It looks ver odd for me. I leave that commented for now, because I’m in production with my employees.

Regards