Veny wrote:
> Could anyone point me a reference on information
> related to JOIN operations?
> E.g. if i wrote the following sql:
> SELECT * FROM Table1, Table2 WHERE Table1.columnA
> = Table2.columnB AND Table1.columnA = 5;
>
> Does MySQL filters all record of Table1 with
> columnA's value equals to 5, and then perform
> JOIN? Or JOIN is perform first before filtering
> out the values?
It depends on which access method is used. If Table1 is accessed using
ALL/index/range/ref(const) access method, then filtering on "Table1.columnA = 5" will
be performed before doing join with Table2.
If Table1 is accessed using ref access method on "Table1.columnA = Table2.columnB"
(suppose there is an index on Table1.columnA) then the join is performed first.
Sergey Petrunia, Software Developer
MySQL AB, www.mysql.com
My blog:
http://s.petrunia.net/blog