MySQL Forums
Forum List  »  PHP

Re: Nested Select Statement Speed Issue
Posted by: Felix Geerinckx
Date: February 03, 2006 04:20AM

Paul Ritchie wrote:

> Can anyone quide me as to what is wrong with my first statement, why it takes so long to process
> (a good 20 to 30 seconds) compared to 2 seconds using the second statement.

Nothing. It's probably an optimizer issue. What do you get when you run

EXPLAIN SELECT ....

for this query?


How does the following work?

SELECT
positionTitle
FROM staff s
JOIN departmentLink dl ON dl.staffId = s.staffId
JOIN departmentInfo di ON di.departmentNumber = dl.departmentNumber
WHERE
di.classificationId = $classificationId and
di.contactId = $contactId and
di.branchId = $branchId and
di.departmentId = $departmentId

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

Options: ReplyQuote


Subject
Written By
Posted
Re: Nested Select Statement Speed Issue
February 03, 2006 04: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.