zwelch: query unter mysql 5.0 schnell aber unter 5.1 langsam ...?!

Beitrag lesen

Es gibt in der Tat Unterschiede ... bei der Server laufen mit der Standard-Konfiguration. Alle Keys und Indezes sollten soweit ich gesehen habe gleich sein.

MySQL 5.0
+----+--------------------+-------+--------+---------------+----------+---------+------------------+------+-----------------------------+
| id | select_type        | table | type   | possible_keys | key      | key_len | ref              | rows | Extra                       |
+----+--------------------+-------+--------+---------------+----------+---------+------------------+------+-----------------------------+
|  1 | PRIMARY            | t     | ALL    | NULL          | NULL     | NULL    | NULL             |  324 | Using filesort              |
|  6 | DEPENDENT SUBQUERY | p     | ref    | id_topic      | id_topic | 4       | elvzw.t.id       |   38 | Using where; Using filesort |
|  5 | DEPENDENT SUBQUERY | p     | ref    | id_topic      | id_topic | 4       | elvzw.t.id       |   38 |                             |
|  4 | DEPENDENT SUBQUERY | w     | eq_ref | PRIMARY       | PRIMARY  | 8       | elvzw.t.id,const |    1 | Using where; Using index    |
|  3 | DEPENDENT SUBQUERY | p     | ref    | id_topic      | id_topic | 4       | elvzw.t.id       |   38 | Using where; Using filesort |
|  2 | DEPENDENT SUBQUERY | p     | ref    | id_topic      | id_topic | 4       | elvzw.t.id       |   38 |                             |
+----+--------------------+-------+--------+---------------+----------+---------+------------------+------+-----------------------------+

MySQL 5.1
+----+--------------------+-------+--------+---------------+----------+---------+---------------------+------+--------------------------+
| id | select_type        | table | type   | possible_keys | key      | key_len | ref                 | rows | Extra                    |
+----+--------------------+-------+--------+---------------+----------+---------+---------------------+------+--------------------------+
|  1 | PRIMARY            | t     | ALL    | NULL          | NULL     | NULL    | NULL                |  324 | Using filesort           |
|  6 | DEPENDENT SUBQUERY | p     | index  | id_topic      | date     | 4       | NULL                |    1 | Using where              |
|  5 | DEPENDENT SUBQUERY | p     | ref    | id_topic      | id_topic | 4       | d00e2dfb.t.id       |   38 |                          |
|  4 | DEPENDENT SUBQUERY | w     | eq_ref | PRIMARY       | PRIMARY  | 8       | d00e2dfb.t.id,const |    1 | Using where; Using index |
|  3 | DEPENDENT SUBQUERY | p     | index  | id_topic      | date     | 4       | NULL                |    1 | Using where              |
|  2 | DEPENDENT SUBQUERY | p     | ref    | id_topic      | id_topic | 4       | d00e2dfb.t.id       |   38 |                          |
+----+--------------------+-------+--------+---------------+----------+---------+---------------------+------+--------------------------+

Das sagt mir allerdings nicht viel ;) Und was ich jetzt zu tun habe ist mir auch nicht klar.

zwelch