Newbie question - MySQL index size

Posted by Tommy on Stack Overflow See other posts from Stack Overflow or by Tommy
Published on 2010-04-08T12:21:40Z Indexed on 2010/04/08 12:23 UTC
Read the original article Hit count: 306

Filed under:
|

I've just started to investigating how I should optimize my database. Indexing seems to be a good idea, so I want to index a VARCHAR column, the engine is MyISAM.

From what I've read, I understand that an index is limited to a size of 1000 bytes. A VARCHAR character is 3 bytes in size. Does this mean that if I want to index a VARCHAR column with 50 rows, I need an index prefix of 6 characters? I came to that number by dividing 1000 with the row number 50, then the bytesize per character that is 3. 1000/50/3=6,66.

It seems a little complicated, so I'm just wondering if I'm thinking right? It seems weird to me that you'd only be able to index 333 rows in a VARCHAR column, using a prefix of 1 character.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about indexing