MySQL Forums
Forum List  »  Performance

Help needed on tuning query with join
Posted by: N.Z. Bear
Date: October 12, 2004 02:42PM

I'm having performance problems on a query which I believe is a result of my poor understanding of how to do an efficient join.

I have two tables: 'links', with several million rows, and 'weblogs', with ~ 15,000 rows.

I need to select a certain set of links from 'links', and look up data from 'weblogs' based on the source id found in 'links'.

So the query I structured looks like:

'select a.id,a.lookup_data,b.source_id,b.criteria from weblogs as a, left join links as b on a.id=b.source_id where b.criteria=criteria



This should only return a few hundred rows of data from links and then look up the lookup_data from weblogs. But the performance on this seems to be pretty terrible. Can anyone suggest a more efficient structure? It seems like this should be easily optimized, but my 'join' knowledge is not up to the task.

Help would be appreciated; thanks!

-N.Z. Bear
The Turth Laid Bear
http://www.truthlaidbear.com

Options: ReplyQuote


Subject
Views
Written By
Posted
Help needed on tuning query with join
6602
October 12, 2004 02:42PM


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.