> > Why isn't the key being used in the "c" (certificate) table?
> > SELECT DISTINCT a.uid, a.company, a.firstname, a.lastname 
> > FROM master_info a, logins lsl, logins lc, certificate c WHERE 
> > a.uid = lsl.uid AND lc.parent = lsl.uid AND lc.uid = c.uid AND 
> > c.void <> 1 AND c.status IN 
> > ('CP', 'MC', 'AIC', 'RP', 'VQ', 'NQ', 'LQ', 'RQ', 'NG', 'EP', 'AA',
> > 'AD' ) AND lsl.active = "1" AND lsl.void = "0" ORDER BY company, uid
> How do you think the key should be used?  You have a key on status, 
> but you're asking for a wide range of status values.  Presumably 
> MySQL thinks (probably correctly) that using the index to find a 
> range of status values from 'AA' to 'VQ' is no faster than doing a 
> full table scan.
> I could be missing something, but if so it would help if you could 
> explain how you expect the key to be used.

Well, I would expect it to use the key on the status column.  But
barring that (as you suggest, MySQL might think that using the
key on status would be no faster), I would at least expect it to be
using the key for the 'uid' field and possible the (uid,void,status)
key as well.  Even just using the key on the uid field could very
well speed the query up as it would be pulling the records matching
the 'status' column from a diminished field of possible records.

Or do I have it all wrong?

Chris
mysql,query,blah


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

Reply via email to