SELECT m1.message, a.some_id, b.some_id, a.some_date, b.some_date
FROM SOME_TABLE a, SOME_TABLE b, MESSAGE_TABLE m1, MESSAGE_TABLE m2
WHERE m2.some_id = a.some_id
AND a.thing_a != ''
AND a.thing_a = b.thing_b
AND b.some_id = m1.some_id
AND m1.message='A REALLY LONG ENCRYPTED MESSAGE!!'
ORDER BY a.some_date, a.some_id;
+----+-------------+-------+--------+---------------+---------+---------+-------------------------+-------+--------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+--------+---------------+---------+---------+-------------------------+-------+--------------------------------+ | 1 | SIMPLE | a | ALL | NULL | NULL | NULL | NULL | 11269 | Using where | | 1 | SIMPLE | b | ALL | NULL | NULL | NULL | NULL | 11269 | Using where; Using join buffer | | 1 | SIMPLE | m1 | eq_ref | PRIMARY | PRIMARY | 4 | oscar_mcmaster.b.lab_no | 1 | Using where | | 1 | SIMPLE | m2 | eq_ref | PRIMARY | PRIMARY | 4 | oscar_mcmaster.a.lab_no | 1 | | +----+-------------+-------+--------+---------------+---------+---------+-------------------------+-------+--------------------------------+
mysql Ver 14.14 Distrib 5.1.41, for debian-linux-gnu (i486) using readline 6.1
| Subject | Written By | Posted |
|---|---|---|
| Nasty Query, Optimization Help Please! | Dave Lawson | 02/17/2012 04:10PM |
| Re: Nasty Query, Optimization Help Please! | Michael Messina | 02/18/2012 02:44AM |
| Re: Nasty Query, Optimization Help Please! | Dave Lawson | 02/22/2012 08:57AM |
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.