MySQL Forums
Forum List  »  Optimizer & Parser

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

Hello,

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


Subject
Views
Written By
Posted
INNER JOIN optimization
13144
February 22, 2010 12:52AM
3861
February 23, 2010 11:44PM
3466
February 27, 2010 01:36PM
3051
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.