MySQL Forums
Forum List  »  Performance

Re: Puzzled: why does join run 27,252 x faster than left outer join?
Posted by: Felix Geerinckx
Date: July 19, 2005 07:30AM

Daniel Brennan wrote:

> The Strange results:
>
> mysql> select sum(b.amount)*-1
> -> from lockbox a join ledger b
> -> on a.payid = b.tranid
> -> or a.secid = b.tranid
> -> or a.petid = b.tranid;
> +------------------+
> | sum(b.amount)*-1 |
> +------------------+
> | 134429.57 |
> +------------------+
> 1 row in set (0.02 sec)
>
> mysql> select sum(b.amount)*-1
> -> from lockbox a left outer join ledger b
> -> on a.payid = b.tranid
> -> or a.secid = b.tranid
> -> or a.petid = b.tranid;
> +------------------+
> | sum(b.amount)*-1 |
> +------------------+
> | 134429.57 |
> +------------------+
> 1 row in set (9 min 44.46 sec)

A LEFT JOIN forces a table read order
(see http://dev.mysql.com/doc/mysql/en/left-join-optimization.html)

Would you care to post the result of

EXPLAIN SELECT ... \G

for both queries?

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Puzzled: why does join run 27,252 x faster than left outer join?
1912
July 19, 2005 07:30AM


Sorry, you can't reply to this topic. It has been closed.

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.