List:General Discussion« Previous MessageNext Message »
From:pouet1234 Date:May 7 2002 5:34pm
Subject:why mysql doesn't want to use my indexes???
View as plain text  
Hi!

I have a little pb with indexes.
when I make an explain on my query I have strange results.
my query looks like this

select *
from  LIST l, WIN c
where l.ID_LIST=c.ID_LIST and l.KEY = '421' and l.ACTIF='1';

table LIST :
ID_LIST(primary key), KEY, ACTIF, ...

table WIN
ID_WIN(primary key),  ID_LIST, ...
there is 2 indexes. One on (LIST.KEY, LIST.ACTIF) and one on (WIN.ID_LIST)

the pb is that explain returns like this :
|table|type|possible_keys|key|key_len|ref|rows|Extra
|l|ref|PRIMARY,idx_key_actif|idx_key_actif|20|const,const|1|where used;
Using index|
|c|ALL|ID_LIST |NULL|NULL|NULL|5|where used|

which means (if I understood the mysql manual...) it prefers not to use the index from
c(WIN table) and scan the
whole table for each row from LIST...
let me say it's not what I want...
can someone explain me why?


Internet et mail gratuit AltaVista http://www.altavista.fr
Thread
why mysql doesn't want to use my indexes???pouet12347 May