Re: RES: [PHP] Mutiple SQL request
| From: | Micah Gersten | Date: | Wed, 04 Feb 2009 22:11:55 +0000 |
| Subject: | Re: RES: [PHP] Mutiple SQL request | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-287657@lists.php.net to get a copy of this message | ||
Jim Lucas wrote:
> <snip>
> I would add a second column to that admin_lastping KEY
>
> KEY
admin_lastping (admin_lastping
>, admin_id)
>
> Since you are using both columns in your where clause, they both need to be specified /in the
> same/ index for and index to be used.
>
> Otherwise, some random index might be used. But you will get the best performance if both are
> listed in the same index.
>
>
This is definitely not true in MySQL 5 and I'm sure other RDBMS
systems. MySQL 5 can use more than 1 index per table now. Also, if
you're using the InnoDB engine, the Primary Key is stored in the
secondary index, so specifying it explicitly is unnecessary.
Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com