If you have an index consisting of member_id & mail_id (opposite 
order), you'll need just one index.

A good explanation of why may be found at:

http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Optimisation.html#Multiple-column_indexes

-rh

>I for sure need an index on the mail_id field (the primary key will be
>between member_id and mail_id), so an index of mail_id AND member_id makes
>sense. This index would work for queries like:
>
>WHERE mail_id = XXX
>WHERE mail_id = XXX AND member_id = YYY
>
>However, that leaves out queries like:
>
>WHERE member_id = YYY
>
>That is also a query I need to be able to do on a regular basis, and if this
>query yields 20,000 results, with 5 million rows in the table, it's going to
>take forever (I assume).
>
>So I was thinking about making two indexes:
>
>mail_id AND member_id
>member_id
>
>Would this take up way too much disk space?

---------------------------------------------------------------------
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