6 messages in com.mysql.lists.mysqlRe: are indexes used on a self join?
FromSent OnAttachments
Mark Maggelet11 Apr 2000 11:13 
Dan Nelson11 Apr 2000 12:25 
Mark Maggelet11 Apr 2000 12:48 
Gerald Clark11 Apr 2000 13:18 
Mark Maggelet11 Apr 2000 13:29 
Dan Nelson11 Apr 2000 14:41 
Subject:Re: are indexes used on a self join?
From:Dan Nelson (dnel@emsphone.com)
Date:04/11/2000 12:25:56 PM
List:com.mysql.lists.mysql

In the last episode (Apr 11), Mark Maggelet said:

Hello, can somebody give me some feedback on a query like this: select distinct(products.id) from products,keywords as a,keywords as b where (products.id=a.id and a.keyword ='black') and (b.keyword ='history');

This query is taking 24 seconds, which is way too long. products.id has an
index, and keywords.keyword also has an index, but I'm not sure that the index for keywords.keyword is being used since I alias it twice.

what does an EXPLAIN on the query look like?