<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:Consolas;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Tahoma","sans-serif";
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Tahoma","sans-serif";
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='color:#1F497D'>Hello all ,<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Thanks for your answers .<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>I have updated our rt3
into  RT 3.8.2 and updated again mysql to 5.0.45  .We have the same
problem, this did not resolved our issue .That query is running for a long
time, causing the table to lock, web interface of the user who is using the
 Search/Build.html page to timeout, and giving other users delays in
accessing the tickets .<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>I have also installed
mysqltuner.pl , there are  no issues reported , everything is green .I
have also used  mysqlreport  to check running parameters , and there
was nothing that could cause an mysql server  performance issue .<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Any other ideas ?<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>

<div>

<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>PS :  Liviu  (the
person who reported first this issue) and I ,we are colleagues working on this
case .<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Greetings,<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Adrian Alexandrescu.<o:p></o:p></span></p>

</div>

<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] <b>On Behalf Of </b>Liviu
Costea<br>
<b>Sent:</b> Friday, April 24, 2009 5:13 PM<br>
<b>To:</b> 'rt-users@lists.bestpractical.com'<br>
<b>Subject:</b> [rt-users] Query Builder very slow after system update<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Hello,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>We
recently updated our RT3 server ( RT 3.8.1 , around 200000 tickets) from Red
Hat Enterprise Linux 5.1 to 5.3 (yum update). The new MySQL installed version
is 5.0.45.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Since
the upgrade RT3 is working normally except Query Builder</span> ( <span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><a
href="http://%3crt3_url%3e/rt3/Search/Build.html">http://<rt3_url>/rt3/Search/Build.html</a>
) which is very slow. I identified the query that’s taking too long:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>mysql>
SELECT DISTINCT main.* FROM Users main CROSS JOIN ACL ACL_4 JOIN Principals
Principals_1  ON ( Principals_1.id = main.id ) JOIN 
CachedGroupMembers CachedGroupMembers_2  ON (
CachedGroupMembers_2.MemberId = Principals_1.id ) JOIN Groups Groups_3  
ON ( Groups_3.id = CachedGroupMembers_2.GroupId )  WHERE 
(Principals_1.Disabled = '0') AND (ACL_4.PrincipalType = Groups_3.Type) 
AND (Principals_1.id != '1') AND (Principals_1.PrincipalType =
'User')   AND (ACL_4.RightName = 'OwnTicket') AND (Groups_3.Domain
=   'RT::Queue-Role') AND ((ACL_4.ObjectType = 'RT::Queue')
OR   (ACL_4.ObjectType = 'RT::System'))  ORDER BY main.Name ASC;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Empty
set (2 min 57.79 sec)<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Additional
info:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>mysql>
EXPLAIN SELECT DISTINCT main.* FROM Users main CROSS JOIN ACL ACL_4 JOIN Principals
Principals_1  ON ( Principals_1.id = main.id ) JOIN 
CachedGroupMembers CachedGroupMembers_2  ON (
CachedGroupMembers_2.MemberId = Principals_1.id ) JOIN Groups
Groups_3   ON ( Groups_3.id = CachedGroupMembers_2.GroupId ) 
WHERE  (Principals_1.Disabled = '0') AND (ACL_4.PrincipalType =
Groups_3.Type)  AND (Principals_1.id != '1') AND
(Principals_1.PrincipalType = 'User')   AND (ACL_4.RightName =
'OwnTicket') AND (Groups_3.Domain =   'RT::Queue-Role') AND
((ACL_4.ObjectType = 'RT::Queue') OR   (ACL_4.ObjectType =
'RT::System'))  ORDER BY main.Name ASC;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>+----+-------------+----------------------+--------+--------------------------------+---------------------+---------+----------------------------------+------+----------------------------------------------+<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>|
id | select_type |
table               
| type   |
possible_keys                 
|
key                
| key_len |
ref                             
| rows |
Extra                                       
|<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>+----+-------------+----------------------+--------+--------------------------------+---------------------+---------+----------------------------------+------+----------------------------------------------+<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>| 
1 | SIMPLE      |
main                
| range  |
PRIMARY                       
| PRIMARY            
| 4       |
NULL                            
|   21 | Using where; Using temporary; Using filesort |<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>| 
1 | SIMPLE      |
Principals_1         | eq_ref |
PRIMARY                       
|
PRIMARY            
| 4       |
rt3.main.id                     
|    1 | Using where;
Distinct                       
|<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>| 
1 | SIMPLE      | CachedGroupMembers_2 |
ref    | DisGrouMem,CachedGroupMembers3 | CachedGroupMembers3 |
5       |
rt3.Principals_1.id             
|    1 | Using where;
Distinct                       
|<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>| 
1 | SIMPLE      |
ACL_4               
| range  |
ACL1                          
|
ACL1               
| 54      |
NULL                            
|   36 | Using where; Using index;
Distinct           |<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>| 
1 | SIMPLE      |
Groups_3            
| eq_ref | PRIMARY,Groups1,Groups2        |
PRIMARY            
| 4       | rt3.CachedGroupMembers_2.GroupId
|    1 | Using where;
Distinct                  
     |<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>+----+-------------+----------------------+--------+--------------------------------+---------------------+---------+----------------------------------+------+----------------------------------------------+<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>5
rows in set (0.04 sec)<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>mysql>
select count(*) from CachedGroupMembers;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>+----------+<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>|
count(*) |<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>+----------+<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>| 
1382038 |<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>+----------+<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>1
row in set (2.56 sec)<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>mysql>
show indexes from CachedGroupMembers;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>+--------------------+------------+---------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>|
Table             
| Non_unique |
Key_name            |
Seq_in_index | Column_name       | Collation |
Cardinality | Sub_part | Packed | Null | Index_type | Comment |<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>+--------------------+------------+---------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>|
CachedGroupMembers |          0 |
PRIMARY            
|            1 |
id               
| A         |    
2138547 |     NULL | NULL  
|      | BTREE     
|         |<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>|
CachedGroupMembers |          1 |
DisGrouMem         
|            1 |
GroupId           |
A         |    
2138547 |     NULL | NULL   | YES  |
BTREE      |        
|<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>|
CachedGroupMembers |          1 |
DisGrouMem         
|            2 |
MemberId          |
A         |    
2138547 |     NULL | NULL   | YES  |
BTREE      |        
|<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>|
CachedGroupMembers |          1 |
DisGrouMem         
|            3 |
Disabled          |
A         |    
2138547 |     NULL | NULL  
|      | BTREE     
|         |<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>|
CachedGroupMembers |          1 |
CachedGroupMembers3
|            1 |
MemberId          | A        
|     2138547 |     NULL |
NULL   | YES  | BTREE     
|         |<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>|
CachedGroupMembers |          1 |
CachedGroupMembers3
|            2 |
ImmediateParentId | A        
|     2138547 |     NULL |
NULL   | YES  | BTREE     
|         |<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>+--------------------+------------+---------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>6
rows in set (0.01 sec)<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>I’ve
also tried to add some indexes for this table with no results (<a
href="http://search.cpan.org/~ruz/RTx-Shredder-0.07/lib/RTx/Shredder.pm#NOTES">http://search.cpan.org/~ruz/RTx-Shredder-0.07/lib/RTx/Shredder.pm#NOTES</a>
)<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>The
temporary workaround was to downgrade MySQL to 5.0.22 (Previous version in RHel
5.1) and the Query Builder is working normally again:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>mysql>
SELECT DISTINCT main.* FROM Users main CROSS JOIN ACL ACL_4 JOIN Principals
Principals_1  ON ( Principals_1.id = main.id ) JOIN 
CachedGroupMembers CachedGroupMembers_2  ON (
CachedGroupMembers_2.MemberId = Principals_1.id ) JOIN Groups
Groups_3   ON ( Groups_3.id = CachedGroupMembers_2.GroupId ) 
WHERE  (Principals_1.Disabled = '0') AND (ACL_4.PrincipalType =
Groups_3.Type)  AND (Principals_1.id != '1') AND
(Principals_1.PrincipalType = 'User')   AND (ACL_4.RightName =
'OwnTicket') AND (Groups_3.Domain =   'RT::Queue-Role') AND ((ACL_4.ObjectType
= 'RT::Queue') OR   (ACL_4.ObjectType = 'RT::System'))  ORDER BY
main.Name ASC;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Empty
set (0.13 sec)<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>But
I want MySQL 5.0.45 installed. Can anyone help on this? <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Thank
you.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Regards,<o:p></o:p></span></p>

<p class=MsoNormal>Liviu <o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

</div>

</body>

</html>