List:Internals« Previous MessageNext Message »
From:Jay Pipes Date:September 8 2005 8:06am
Subject:Re: Some MYI-related questions
View as plain text  

> At 21:04 +0200 9/7/05, Hagen Höpfner wrote:
> 
>> Dear list,
>>
>> after stopping my activities to understand the MySQL interna a little
>> bit for a while, I now started agin with the MYI-structure. Therefore, I
>> have some questions. Hopefully someone can and will answer these
>> questions ;-)
>>
>> (1) The state-part of the header contains a version number (first 4
>> bytes). Is this the version number of the MyISAM driver? I currently use
>> MySQL 5.0.4beta where the version is 0xFE FE 07 01.

No, the version is simply a "magic number".  In the programming world, 
it generally means a binary representation of something that normally 
wouldn't appear in the "real world".  It's used as a kind of 
placeholder, or a symbol to ensure that the file "is what it says it 
is".  The definition for it can be found in /myisam/mi_static.c.

>>
>> (2) The next part (2 Bytes) of the header includes options like
>> HA_OPTION_PACK_RECORD ... Are these options the values defined in 
>> my_base.h:
>>
>> /* optionbits for database */
>> #define HA_OPTION_PACK_RECORD           1
>> #define HA_OPTION_PACK_KEYS             2
>> #define HA_OPTION_COMPRESS_RECORD       4
>> #define HA_OPTION_LONG_BLOB_PTR         8 /* new ISAM format */
>> #define HA_OPTION_TMP_TABLE             16
>> #define HA_OPTION_CHECKSUM              32
>> #define HA_OPTION_DELAY_KEY_WRITE       64
>> #define HA_OPTION_NO_PACK_KEYS          128  /* Reserved for MySQL */
>> #define HA_OPTION_TEMP_COMPRESS_RECORD  ((uint) 16384)  /* set by 
>> isamchk */
>> #define HA_OPTION_READ_ONLY_DATA        ((uint) 32768)  /* Set by 
>> isamchk */
>>
>> If so, what does these options stand for?

Yes, these correspond with the MyISAM handler's flags for the options 
available on the table and it's indexes.  These flags are used as masks 
in the storage engine code in order to determine what capabilities the 
base table and it's related indexes support.

>>
>> (3) What is the different between the key_parts and unique_key_parts?

Both are meta information for use by the index.  key_parts is simply a 
count of the number of columns used in all indexes on the table. 
unique_key_parts is simply the number of columns in UNIQUE or PRIMARY keys.

>>
>> (4) What is the "language" of an index?

No idea.  Possibly a collation code?  Perhaps one of the developers 
would know... :)

Cheers,

Jay
Thread
Some MYI-related questionsHagen Höpfner7 Sep
  • Re: Some MYI-related questionsPaul DuBois7 Sep
    • Re: Some MYI-related questionsHagen Höpfner8 Sep
    • Re: Some MYI-related questionsJay Pipes8 Sep
  • Re: Some MYI-related questionsSergei Golubchik8 Sep