MySQL Forums
Forum List  »  MyISAM

Re: How to shrink the size of the index file for a myisam table ?
Posted by: Ingo Strüwing
Date: April 25, 2006 05:08AM

The index records consist basically of the key value (3 or 4 bytes in your case) and the "Datafile pointer (bytes): 4".

All that can be packed is the key value. You may imagine that it is difficult to pack a 4 byte value if it contains many different numbers. The only chance for remarkable compression is to have only a few different values many times. Repititions of the same key value are coded with one byte. Packing of value changes is done like so:

- 1 byte, number of bytes starting the same as the previous key,
- 1 byte, number of bytes following that point
- x bytes, fragment of new key.

This gives a 8:7 compression if the values change just in the least significant byte (provided that key values for numbers are stored big endian, which I'm not totally sure about at the moment), and no compression when one key value changes more than in the least significant byte against the previous one (we won't pack a key value if would become bigger).

So I guess you don't have the same numbers so often in your table that you can profit from enforced key packing.

Ingo Strüwing, Senior Software Developer - Storage Engines
MySQL AB, www.mysql.com

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.