AnsweredAssumed Answered

Slow queries in 7.5 list views

Question asked by Steve Cox on Jul 28, 2015
Latest reply on Apr 4, 2016 by Enrico Simonetti
Just rolled out with 7.5 and we have some slow queries with contact and account list views for non-admin users. Looks similar to the 'DISTINCT' issues with 7.2 but these queries don't use that option.

The culprit looks to be a joined select for team sets. If I try to cut out the later superfluous joins to something more readable, the query is akin to this:

SELECT contacts.*
FROM contacts INNER JOIN (select tst.team_set_id from team_sets_teams tst INNER JOIN team_memberships team_memberships ON tst.team_id = team_memberships.team_id
                    AND team_memberships.user_id = '201944fa-daad-6278-0137-51b1973949ef'
                    AND team_memberships.deleted=0 group by tst.team_set_id) contacts_tf on contacts_tf.team_set_id  = contacts.team_set_id WHERE contacts.deleted = 0  ORDER BY contacts.date_modified desc  LIMIT 0,21

The 'explanation' for this is 'using where; using temporary, using filesort' and can take 20 secs