All pastes #264989 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-12-02 22:04 UTC
rendered paste body
explain SELECT * FROM `votos_totales` v LEFT JOIN `yabbse_members` y ON (y.`ID_MEMBER`=v.`id`) WHERE 1 AND y.`suspendido`='0' AND `ganador_semana`='1' AND y.`tiene_foto`='1' ORDER BY v.`votos` DESC LIMIT 718,15;

+----+-------------+-------+--------+---------------+---------+---------+--------------+--------+-------------+
| id | select_type | table | type   | possible_keys | key     | key_len | ref          | rows   | Extra       |
+----+-------------+-------+--------+---------------+---------+---------+--------------+--------+-------------+
|  1 | SIMPLE      | v     | index  | PRIMARY       | votos   | 4       | NULL         | 510626 |             | 
|  1 | SIMPLE      | y     | eq_ref | PRIMARY       | PRIMARY | 4       | genteya.v.id |      1 | Using where | 
+----+-------------+-------+--------+---------------+---------+---------+--------------+--------+-------------+

SELECT * FROM `votos_totales` v LEFT JOIN `yabbse_members` y ON (y.`ID_MEMBER`=v.`id`) WHERE 1 AND y.`suspendido`='0' AND `ganador_semana`='1' AND y.`tiene_foto`='1' ORDER BY v.`votos` DESC LIMIT 718,15;
Empty set (18.96 sec)

explain SELECT * FROM `votos_totales` v LEFT JOIN `yabbse_members` y ON (y.`ID_MEMBER`=v.`id`) WHERE 1 AND y.`suspendido`='0' AND y.`tiene_foto`='1' ORDER BY v.`votos` DESC LIMIT 718,15;

+----+-------------+-------+--------+---------------+---------+---------+--------------+--------+-------------+
| id | select_type | table | type   | possible_keys | key     | key_len | ref          | rows   | Extra       |
+----+-------------+-------+--------+---------------+---------+---------+--------------+--------+-------------+
|  1 | SIMPLE      | v     | index  | PRIMARY       | votos   | 4       | NULL         | 510626 |             | 
|  1 | SIMPLE      | y     | eq_ref | PRIMARY       | PRIMARY | 4       | genteya.v.id |      1 | Using where | 
+----+-------------+-------+--------+---------------+---------+---------+--------------+--------+-------------+

SELECT * FROM `votos_totales` v LEFT JOIN `yabbse_members` y ON (y.`ID_MEMBER`=v.`id`) WHERE 1 AND y.`suspendido`='0' AND y.`tiene_foto`='1' ORDER BY v.`votos` DESC LIMIT 718,15;
...
15 rows in set (0.03 sec)


the only difference between both querys is that i supressed `ganador_semana`='1'

explain show the same for both, but the first take 18 seconds and the second 0.03s.

why???