
Originally Posted by
DJuser Have other folks made the same SQL changes we have?
Our slow_query_log was showing nearly *every* page was having the exact same 1/4 second query.
We fixed it, by creating a query in table Calls for reminder_time
create index idx_reminder_time on calls (reminder_time)
And pages are noticeably faster (still bot fast enough).
We run 4.5.1.e, nothing custom, just changes made by Studio.
Our Calls table is 22,000 records - imported from an Access application: running on a LAMP box with 2GB RAM, nothing but Sugar running
Max of 3 users on the system.
It makes us wonder why this index was not already in place?
Sugar just 'felt slow' from the start for us - which drove us to look at slow_queries.
It's still to slow, so we've made further looks at the slow_query log show , which suggest that some other queries are not optimal too: eg the one below, taking 0.7 second - which seems way too slow, given the small size of the tables.
The OR is the root cause for this query being slow (we tested); but isn't that poor SQL design to have the OR running - isn't calls_Users the 'correct' place for user_ids - so why does calls also have a user_id column (assigned_user_id) ??
Could we find the PHP and remove the OR part?
Sounds like lack of normalisation - but I guess we must be missing somethng, or else folks would have spotted and foxed these long ago?
Thoughts?
DJUser
Wed Jul 11 22:41:44 2007,311 [12221] FATAL SugarCRM - Slow Query (time:0.719901
SELECT count(*) c FROM calls INNER JOIN calls_users ON calls.id = calls_users.call_id where (calls.status IN ('Planned')
) AND calls.deleted=0 AND calls_users.deleted = 0 AND (calls.assigned_user_id = '6a97b4a9-b88d-4a04-471b-46556f0cd8ce' OR calls_users.user_id = '6a97b4a9-b88d-4a04-471b-46556f0cd8ce')
Bookmarks