MySQL indexes: how do they work?

Posted by bob-the-destroyer on Stack Overflow See other posts from Stack Overflow or by bob-the-destroyer
Published on 2011-01-09T03:12:02Z Indexed on 2011/01/09 3:53 UTC
Read the original article Hit count: 284

Filed under:
|

I'm a complete newbie with MySQL indexes. I have several MyISAM tables on MySQL 5.0x having utf8 charsets and collations with 100k+ records each. The primary keys are generally integer. Many columns on each table may have duplicate values.

I need to quickly count, sum, average, or otherwise perform custom calculations on any number of fields in each table or joined on any number of others.

I found this page giving an overview of MySQL index usage: http://dev.mysql.com/doc/refman/5.0/en/mysql-indexes.html, but I'm still not sure I'm using indexes right. Just when I think I've made the perfect index out of a collection of fields I want to calculate against, I get the "index must be under 1000 bytes" error.

Can anyone explain how to most efficiently create and use indexes to speed up queries?

Caveat: upgrading Mysql is not possible in this case. Using Navicat Light for db administration, but this app isn't required.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about indexes