Paweł Rohde pisze:
Paweł Rohde pisze:
Witam,
Przenoszę system ze slackware 10 na ubuntu server 8.04 LTS
Logowanie do nowego systemu trwa dłuuuuuugo (stary 3s nowy 22s)
Stary serwer to: 2xPIII 800MHz 512RAM mysql: 5.0.24a
Nowy serwer to: 2xPIII 1400MHz 2024RAM mysql: 5.0.51a-3ubuntu5.4
Ilość wykonywanych zapytań przy odświeżaniu strony info na starym: 166 Ilość wykonywanych zapytań przy odświeżaniu strony info na nowym: 1211337
Co on do cholery robi ?
Chyba winny jest customersview:
A dokładniej to zapytanie: SELECT SUM(value) FROM cash LEFT JOIN customersview ON customerid = customersview.id WHERE deleted = 0 GROUP BY customerid HAVING SUM(value) < 0;
wykonywanie odpowiednio: (11.49 sec) i (1.10 sec)
nie umiem czytać niestety explain dla mysql :(
mysql> explain extended SELECT SUM(value) FROM cash LEFT JOIN customersview ON customerid = customersview.id WHERE deleted = 0 GROUP BY customerid HAVING SUM(value) < 0; +----+--------------------+-------+--------+-----------------------------------------------------------------------+-----------------+---------+----------------------------------+-------+---------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+--------------------+-------+--------+-----------------------------------------------------------------------+-----------------+---------+----------------------------------+-------+---------------------------------+ | 1 | PRIMARY | cash | ALL | customerid | NULL | NULL | NULL | 49004 | Using temporary; Using filesort | | 1 | PRIMARY | c | eq_ref | PRIMARY,id_2,id | PRIMARY | 4 | lms2.cash.customerid | 1 | Using where | | 3 | DEPENDENT SUBQUERY | e | index | NULL | userid | 8 | NULL | 30 | Using where; Using index | | 3 | DEPENDENT SUBQUERY | a | eq_ref | customergroupid,customergroupid_2,customergroupid_3,customergroupid_4 | customergroupid | 8 | lms2.e.customergroupid,lms2.c.id | 1 | Using where; Using index | +----+--------------------+-------+--------+-----------------------------------------------------------------------+-----------------+---------+----------------------------------+-------+---------------------------------+ 4 rows in set, 2 warnings (0.01 sec)
!DSPAM:4aaeb6f3278461910919020!