Run explain on the query and see if indexes are being used.

John Almberg wrote:

I am trying to find records (from the 'stamps' table) that are NOT related to records in the 'links' table. To do this, I'm using a left join. For example:

select s.*, l.item_id as lid from stamps as s left join links as l on (( s.item_id=l.item_id)) WHERE (s.sold is null);

This worked great when there were just a few records in each table, but now that there are about 4000 records in each table, this simple query has slowed down to a crawl. It currently takes about 2 minutes to execute on a linux machine. Not good enough, especially since there will ultimately be at least 10,000 records in each table.

Is there a better technique for doing this kind of search? Any suggestions much appreciated.

Brgds: John




-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to