Re: speeding up a search

2003-09-23 Thread Mojtaba Faridzad
Message - From: "John Almberg" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, September 23, 2003 12:37 PM Subject: speeding up a search > I am trying to find records (from the 'stamps' table) that are NOT > related to records in the '

Re: speeding up a search

2003-09-23 Thread Kelley Lingerfelt
Make sure stamps.item_id and links.item_id are indexed, I had a similar problem, and when I indexed the columns, it went down to less than a half second. KL 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

Re: speeding up a search

2003-09-23 Thread gerald_clark
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 li

Re: speeding up a search

2003-09-23 Thread John Almberg
Wow! One of the fields was a primary key, but the other wasn't. When I indexed the second field the performance went up from 2 minutes to about 2 seconds. Thanks a bunch. -- John Kelley Lingerfelt wrote: Make sure stamps.item_id and links.item_id are indexed, I had a similar problem, and when

speeding up a search

2003-09-23 Thread John Almberg
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 w