NYCPHP Meetup

NYPHP.org

[nycphp-talk] Table Indexes

John Campbell jcampbell1 at gmail.com
Sun Sep 7 14:31:48 EDT 2008


> Can anyone recommend which method I should try first?

Don't create the auto increment pk, as it is unnecessary.

With MySQL the fastest is often:

Primary(a,b)
index(b)

And in sometimes you even want:

Primary(a,b)
index(a)
index(b)

I think mysql treats primary key pairs as a simple concatenation.  If
you don't index b, then the searches are really slow.

Regards,
John Campbell



More information about the talk mailing list