<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: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: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;}
 /* 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;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Tahoma","sans-serif";
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
.MsoChpDefault
        {mso-style-type:export-only;}
@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='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>