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