NSLM (nslm) wrote,

Slow DB queries...

I'm currently trying to upgrade a copy of RT including a mass of customizations...

The vast bulk of this appears to be leading to a reasonable speed increase. One page is running rather slow. The "Search Query Builder". Watch what's going on on the server. MySQL is getting somewhat hammered. Turn on the slow query logging.

==> /var/lib/mysql/$SERVERNAME-slow.log <==
# Time: 070810 10:36:37
# User@Host: $USERNAME[$USERNAME] @ localhost []
# Query_time: 47 Lock_time: 0 Rows_sent: 624 Rows_examined: 6908112
SELECT DISTINCT main.* FROM Users main , Principals Principals_1, CachedGroupMembers CachedGroupMembers_2, Groups Groups_3, ACL ACL_4 WHERE ((ACL_4.PrincipalType = Groups_3.Type)) AND ((ACL_4.RightName = 'OwnTicket')) AND ((CachedGroupMembers_2.MemberId = Principals_1.id)) AND ((Groups_3.id = CachedGroupMembers_2.GroupId)) AND ((Principals_1.Disabled = '0')) AND ((Principals_1.PrincipalType = 'User')) AND ((Principals_1.id != '1')) AND ((main.id = Principals_1.id)) AND ((ACL_4.ObjectType = 'RT::Queue') OR (ACL_4.ObjectType = 'RT::System')) AND ((Groups_3.Domain = 'RT::Queue-Role') OR (Groups_3.Domain = 'RT::System-Role')) ORDER BY main.Name ASC;

Hmmm just shy of 7 million rows being queried, for 624 results, that might do it.
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded