All pastes #79868 Raw Edit

Someone

public sql v1 · immutable
·published 2006-07-05 20:22 UTC
rendered paste body
mysql> explain select id, confession from Confessions.confessions left join Confessions.scores on id = confession_id where score > 0.5 order by rand() limit 1;+----+-------------+-------------+--------+---------------+---------+---------+----------------------------------+------+----------------------------------------------+| id | select_type | table       | type   | possible_keys | key     | key_len | ref                              | rows | Extra                                        |+----+-------------+-------------+--------+---------------+---------+---------+----------------------------------+------+----------------------------------------------+|  1 | SIMPLE      | scores      | ALL    | PRIMARY       | NULL    | NULL    | NULL                             |   64 | Using where; Using temporary; Using filesort ||  1 | SIMPLE      | confessions | eq_ref | PRIMARY       | PRIMARY | 4       | Confessions.scores.confession_id |    1 | Using where                                  |+----+-------------+-------------+--------+---------------+---------+---------+----------------------------------+------+----------------------------------------------+2 rows in set (0.00 sec)mysql> explain select c.id, c.confession from Confessions.confessions as c INNER JOIN Confessions.scores as s ON (c.id=s.confession_id) WHERE s.score > 0.5 order by rand() limit 1;+----+-------------+-------+--------+---------------+---------+---------+-----------------------------+------+----------------------------------------------+| id | select_type | table | type   | possible_keys | key     | key_len | ref                         | rows | Extra                                        |+----+-------------+-------+--------+---------------+---------+---------+-----------------------------+------+----------------------------------------------+|  1 | SIMPLE      | s     | ALL    | PRIMARY       | NULL    | NULL    | NULL                        |   64 | Using where; Using temporary; Using filesort ||  1 | SIMPLE      | c     | eq_ref | PRIMARY       | PRIMARY | 4       | Confessions.s.confession_id |    1 | Using where                                  |+----+-------------+-------+--------+---------------+---------+---------+-----------------------------+------+----------------------------------------------+2 rows in set (0.00 sec)