On 21-Jul-2001 Benjamin Pflugmann wrote:
> Hi David!
> 

<snip good discussion on optimizing joins>

> 
> Filesize and insertion/update speed are the main reasons. Another is
> to only use what you really need, i.e. creating indexes which you are
> not sure about using at all, should be avoided.
> 
>> I use PHPmyAdmin a lot to place indexes and I also noticed that you
>> can place two indexes on the same column..?? 
> 
> To place two keys on the same column may be possible but doesn't help
> anything. 
> 
> There is one exception, though, there are compound keys, which will be
> of use. So,
> 
> INDEX(id), INDEX(id)
> 
> makes no sense, but 
> 
> IDNEX(id), INDEX(id,ordernr) 
> 
> may make sense. 
> 

Benjamin, I'll pick a nit here. 
A query on id only can use either index, a query on id & ordernr could
also use both indexes but the second one would be more useful.
A query on ordernr only can't use either, and will result in a full scan.

ITYM:
 INDEX(id), INDEX(ordernr,id)

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.
                            (53kr33t w0rdz: sql table query)

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to