MySQL Forums
Forum List  »  Optimizer & Parser

INNER JOIN optimization
Posted by: Irfan Ali
Date: February 22, 2010 12:52AM


I have some of the queries with INNER JOIN with multiple fields in WHERE caluse. I am wondering is that possible to improve query performance if we filter records first than apply equi-join ?

I tried by putting WHERE caluse up from equi-join. But EXPLAIN shows same plan as earlier. I thought if we filter records set first than apply equi join that would be much faster.

Please let me know with example. original query is as follows:

SELECT t1.empid,t1.empname,t2.deptname from employees t1
INNER JOIN departments t2
ON t1.deptid = t2.deptid
WHERE t2.deptname = 'Sales'
AND t1.empname LIKE 'p%';

Options: ReplyQuote

Written By
INNER JOIN optimization
February 22, 2010 12:52AM
February 23, 2010 11:44PM
February 27, 2010 01:36PM
February 28, 2010 11:20AM

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.