I am diagnosing slowness with our eGroupware implementation and I would like to relate a slowness issue I have been experience. One of the queries, executed from phpgwapi\inc\class.accounts_sql.inc.php on line 385 - 387, occasionally takes 2 minutes to complete. Please see my log from MySQL below. This table has 210 records in it. When I do an explain on the query, it is doing a full table scan on the accounts table, but that shouldn’t take 2 minutes. I am wondering if the time is from some locking issue. Maybe from one user logging in and another looking at the address book or something along those lines. I am not exactly sure why this query is running so long or how to optimize the table to improve performance. Any suggestions?
=============
7 Queries
Total time: 826, Average time: 118
Taking 6 , 33 , 96 , 122 , 169 , 173 , 227 seconds to complete
Rows analyzed 177, 213, 278, 304, 316, 396 and 396
SELECT egw_addressbook.*,account_lid,account_type,egw_accounts.account_id FROM egw_addressbook RIGHT JOIN egw_accounts ON egw_accounts.account_id=egw_addressbook.account_id WHERE (contact_owner=XXX OR contact_owner IS NULL) AND (egw_addressbook.contact_owner=XXX OR contact_private=XXX AND egw_addressbook.contact_owner IN (XXX,XXX,XXX) OR egw_addressbook.contact_owner IS NULL);
SELECT egw_addressbook.*,account_lid,account_type,egw_accounts.account_id FROM egw_addressbook RIGHT JOIN egw_accounts ON egw_accounts.account_id=egw_addressbook.account_id WHERE (contact_owner=0 OR contact_owner IS NULL) AND (egw_addressbook.contact_owner=28 OR contact_private=0 AND egw_addressbook.contact_owner IN (18,28,0) OR egw_addressbook.contact_owner IS NULL);