Hi,

I've got 24666 records in the accounts table and 41457 records in the contacts table. Not really that many for sugar to handle.

However when clicking on the contacts menu link in sugar it takes ages to load.

I've logged the slow query and it is the following. It takes on average 16 seconds to execute!! I've put a clone of the db on a server that no-one is using and rerun the query, it still takes the same amount of time!

Can anyone tell me why this might have suddenly started happening?

Code:
SELECT count(*) c FROM contacts   LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c   LEFT JOIN  accounts_contacts jtl0 ON contacts.id=jtl0.contact_id  AND jtl0.deleted=0
 LEFT JOIN  accounts accounts ON accounts.id=jtl0.account_id AND accounts.deleted=0
 AND accounts.deleted=0  LEFT JOIN  users jt1 ON
jt1.id= contacts.assigned_user_id AND jt1.deleted=0
 AND jt1.deleted=0 where contacts.deleted=0