List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:August 2 2008 7:22pm
Subject:Re: MyISAM Data files, trailing row-bytes
View as plain text  
Hi!

On Aug 02, Jan Kneschke wrote:
> I have a simple table:
>
> CREATE TEMPORARY TABLE `temp_tbl` (
>   `id` int(11) DEFAULT NULL
> ) ENGINE=MyISAM DEFAULT CHARSET=latin1
>
> > select * from temp_tbl;
> +------+
> | id   |
> +------+
> |    1 |
> | NULL |
> |   -1 |
> +------+
>
> Dumping the file I get:
>
>   [0000]  fd 01 00 00 00 00 00 ff 00 00 00 00 00 00 fd ff
>   [0010]  ff ff ff 00 00
>
> ... or unrolled:
>
> fd   01 00 00 00   00 00
> ff   00 00 00 00   00 00
> fd   ff ff ff ff   00 00
>
> I would have expected to get the header-byte + 4 bytes for my INT.
>
> Even http://forge.mysql.com/wiki/MySQL_Internals_MyISAM doesn't talk about 
> the trailing 00 in fixed format.

It's 5.1 ? myisam_data_pointer_size is 6 by default.
In the fixed format a record cannot be smaller than
myisam_data_pointer_size + 1.

It's for deleted chain - the first bit of the record tells if the record
is deleted, and if it is, the following myisam_data_pointer_size bytes
tell where the next deleted record is.

In dynamic format, there's no "deleted" bit, it's stored in the chunk
header instead.

Regards / Mit vielen Grüssen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Engineer/Server Architect
/_/  /_/\_, /___/\___\_\___/  Sun Microsystems GmbH, HRB München 161028
       <___/                  Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Häring
Thread
MyISAM Data files, trailing row-bytesJan Kneschke2 Aug
  • Re: MyISAM Data files, trailing row-bytesSergei Golubchik2 Aug