List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:September 8 2005 9:09am
Subject:Re: Some MYI-related questions
View as plain text  
Hi!

On Sep 07, Hagen H?pfner wrote:
> 
> (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, it's just to mean "this is MYI file".
 
> (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

dynamic row format

> #define HA_OPTION_PACK_KEYS             2

It doesn't do anything in MyISAM, as far as I can see.

> #define HA_OPTION_COMPRESS_RECORD       4

Data file is compressed with myisampack

> #define HA_OPTION_LONG_BLOB_PTR         8 /* new ISAM format */

According to this part from mi_open():

    if (share->options &
        ~(HA_OPTION_PACK_RECORD | HA_OPTION_PACK_KEYS |
          HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA |
          HA_OPTION_TEMP_COMPRESS_RECORD | HA_OPTION_CHECKSUM |
          HA_OPTION_TMP_TABLE | HA_OPTION_DELAY_KEY_WRITE))
    {
      DBUG_PRINT("error",("wrong options: 0x%lx", share->options));
      my_errno=HA_ERR_OLD_FILE;
      goto err;
    }

HA_OPTION_LONG_BLOB_PTR is apparently not used in MyISAM :)

> #define HA_OPTION_TMP_TABLE             16

MyISAM assumes this table is not used by other threads - disables
locking, disables concurrent insert support, does not update table's
header, etc.

> #define HA_OPTION_CHECKSUM              32

Maintain table's checksum - update it after all inserts/deletes/updates.

> #define HA_OPTION_DELAY_KEY_WRITE       64

see DELAY_KEY_WRITE in the CREATE TABLE page on the manual.

> #define HA_OPTION_NO_PACK_KEYS          128  /* Reserved for MySQL */

According to the code snippet above, this option is not used in MyISAM.

> #define HA_OPTION_TEMP_COMPRESS_RECORD  ((uint) 16384)  /* set by isamchk */

it's only used for 'myisamchk --unpack'

> #define HA_OPTION_READ_ONLY_DATA        ((uint) 32768)  /* Set by isamchk */

Table is readonly.
Usually it's set on open, not written in the file:

  if (mode == O_RDONLY || options & HA_OPTION_COMPRESS_RECORD)
    options|=HA_OPTION_READ_ONLY_DATA;
 
> If so, what does these options stand for?
> 
> (3) What is the different between the key_parts and unique_key_parts?

The same difference as betweek 'key' and 'unique', MI_KEYDEF and
MI_UNIQUEDEF. 'key' is the regular index, including UNIQUE index.
'unique' is an index over a hashed value of included columns. It's used
to maintain unique constraint over a set of columns that is longer than
a regular key can support. Currently it's only used internally in
temporary tables for SELECT DISTINCT.
 
> (4) What is the "language" of an index?

collation.

Regards,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, Senior Software Developer
/_/  /_/\_, /___/\___\_\___/  Kerpen, Germany
       <___/  www.mysql.com
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