Re: [rt-users] Huge Attachments table in 3.4.4

2005-10-26 Thread Luke Vanderfluit

Hi.

Jesse Vincent wrote:


On Tue, Oct 25, 2005 at 04:14:46PM +0930, Luke Vanderfluit wrote:
 


Hi.

I have upgraded RT from 3.0.11 to 3.4.4. Mysql 4.0.18, Apache 1.3.27 
(with static modperl module).

The database we are using is quite large.
The main problem we are having is when a user needs to comment on a 
ticket, the loading of a ticket can take quite a long time.

This is due to mysql churning through data.
I'd like to find out how to speed up this process.

How do I find out what tables mysql is checking through when RT is 
loading the Update.html page?
   



You might want to start with Jeremy Zawodney's 'mytop' tool.  

 


Thanks. I have installed this and it's great :-).

I have found by using mysqladmin 'processlist' and by logging 
slowqueries that the query responsible for the slowness is this:

/
SELECT DISTINCT main.* FROM Users main , Principals Principals_1, ACL 
ACL_2, Groups Groups_3, CachedGroupMembers CachedGroupMembers_4  WHERE 
((ACL_2.RightName = 'OwnTicket')) AND ((CachedGroupMembers_4.MemberId = 
Principals_1.id)) AND ((Groups_3.id = CachedGroupMembers_4.GroupId)) AND 
((Principals_1.Disabled = '0')or(Principals_1.Disabled = '0')) AND 
((Principals_1.id != '1')) AND ((main.id = Principals_1.id)) AND  ( (
ACL_2.PrincipalId = Groups_3.id AND ACL_2.PrincipalType = 'Group' AND 
(   Groups_3.Domain = 'SystemInternal' OR Groups_3.Domain = 
'UserDefined' OR Groups_3.Domain = 'ACLEquivalence')) OR ( ( 
(Groups_3.Domain = 'RT::Queue-Role' AND Groups_3.Instance = 23)  OR ( 
Groups_3.Domain = 'RT::Ticket-Role' AND Groups_3.Instance = 238803)  )  
AND Groups_3.Type = ACL_2.PrincipalType) )  AND (ACL_2.ObjectType = 
'RT::System' OR  (ACL_2.ObjectType = 'RT::Queue' AND ACL_2.ObjectId = 
23) )ORDER BY main.Name ASC;

\

Any ideas on how to increase the speed of this query?
I'm currently running RT 3.4.4 upgraded from 3.0.11 on a relatively slow 
box.
If I run the query after a fresh restart of mysql, it takes 150 seconds 
(yes it's a large database :-)

If I then run the following command
'optimize table Users, Principals, ACL, Groups, CachedGroupMembers;'
the query takes roughly 90 seconds to complete.
This is an improvement but hasn't addressed the root cause of why the 
query takes so long.


There may be an index that I can add to the tables to improve 
performance to normal speed which should be around 3-5 seconds on this box.


Here are the existing indexes on the tables involved in this query:
/
mysql> show index from Users;
+---++--+--+--+---+-+--++--++-+
| Table | Non_unique | Key_name | Seq_in_index | Column_name  | 
Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |

+---++--+--+--+---+-+--++--++-+
| Users |  0 | PRIMARY  |1 | id   | 
A |   99402 | NULL | NULL   |  | BTREE  | |
| Users |  0 | Users1   |1 | Name | 
A |   99402 | NULL | NULL   |  | BTREE  | |
| Users |  1 | Users2   |1 | Name | 
A |   99402 | NULL | NULL   |  | BTREE  | |
| Users |  1 | Users3   |1 | id   | 
A |   99402 | NULL | NULL   |  | BTREE  | |
| Users |  1 | Users3   |2 | EmailAddress | 
A |   99402 | NULL | NULL   | YES  | BTREE  | |
| Users |  1 | Users4   |1 | EmailAddress | 
A |   99402 | NULL | NULL   | YES  | BTREE  | |

+---++--+--+--+---+-+--++--++-+
mysql> show index from Principals;
+++-+--+-+---+-+--++--++-+
| Table  | Non_unique | Key_name| Seq_in_index | Column_name | 
Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |

+++-+--+-+---+-+--++--++-+
| Principals |  0 | PRIMARY |1 | id  | 
A | 1212037 | NULL | NULL   |  | BTREE  | |
| Principals |  1 | Principals2 |1 | ObjectId| 
A | 1212037 | NULL | NULL   | YES  | BTREE  | |

+++-+--+-+---+-+--++--++-+
mysql> show index from ACL;
+---++-

Re: [rt-users] Huge Attachments table in 3.4.4

2005-10-26 Thread Gleb Paharenko
Hello.



>>

> I changed the log level to 'alert' but got output in the log file.

> Stopped and started the (apache) server and mysql server.

> Any particular level that I should set it to?





You should enable slow log in mysql configuration file. See:

  http://dev.mysql.com/doc/mysql/en/Slow_query_log.html

  http://dev.mysql.com/doc/mysql/en/Program_Options.html





Luke Vanderfluit wrote:

> Hi.

> 

> Ruslan Zakirov wrote:

> 

>> On 10/25/05, Luke Vanderfluit <[EMAIL PROTECTED]> wrote:

>>  

>>

>>> Hi.

>>>

>>> I have upgraded RT from 3.0.11 to 3.4.4. Mysql 4.0.18, Apache 1.3.27

>>> (with static modperl module).

>>> The database we are using is quite large.

>>> The main problem we are having is when a user needs to comment on a

>>> ticket, the loading of a ticket can take quite a long time.

>>> This is due to mysql churning through data.

>>> I'd like to find out how to speed up this process.

>>>

>>> How do I find out what tables mysql is checking through when RT is

>>> loading the Update.html page?

>>>   

>>

>> http://wiki.bestpractical.com/?Debug

>>

>>  

>>

> I changed the log level to 'alert' but got output in the log file.

> Stopped and started the (apache) server and mysql server.

> Any particular level that I should set it to?

> 

> Kind regards.

> 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
   <___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: [rt-users] Huge Attachments table in 3.4.4

2005-10-26 Thread Luke Vanderfluit

Hi.

Ruslan Zakirov wrote:


On 10/25/05, Luke Vanderfluit <[EMAIL PROTECTED]> wrote:
 


Hi.

I have upgraded RT from 3.0.11 to 3.4.4. Mysql 4.0.18, Apache 1.3.27
(with static modperl module).
The database we are using is quite large.
The main problem we are having is when a user needs to comment on a
ticket, the loading of a ticket can take quite a long time.
This is due to mysql churning through data.
I'd like to find out how to speed up this process.

How do I find out what tables mysql is checking through when RT is
loading the Update.html page?
   


http://wiki.bestpractical.com/?Debug

 


I changed the log level to 'alert' but got output in the log file.
Stopped and started the (apache) server and mysql server.
Any particular level that I should set it to?

Kind regards.

--
Luke