MySQL Forums
Forum List  »  Optimizer & Parser

Re: Optimizing left outer join query
Posted by: Toa Sty
Date: September 25, 2006 03:00AM

Hi Muhammad,

How many rows would you expect vendor_id = 1002 to match? I ask because for some reason MySQL is deciding to table-scan all of vendor_products which seems odd considering you have an index on vendor_id. If most of the rows in the vendor_products table have a vendor_id of 1002 then I'd expect this behaviour but otherwise I wouldn't.

Try running ANALYZE TABLE on both tables and re-running the explain query to see if you get a better result.

Can you post the explain plan afterwards either way please? It would be good to see a count of the number of vendor_id=1002 rows too.

HTH,
Toasty

-----------------------------------------
email: 'toasty'*3 at gmail

Options: ReplyQuote


Subject
Views
Written By
Posted
14171
September 24, 2006 11:40PM
Re: Optimizing left outer join query
4707
September 25, 2006 03:00AM
4422
September 25, 2006 08:09AM
3713
September 25, 2006 09:55PM
3554
September 26, 2006 03:35AM
5038
September 26, 2006 04:06AM
3105
September 26, 2006 06:31PM


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.