List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:December 10 2007 7:08pm
Subject:Re: More documentation about MYD record file structre
View as plain text  
Hi!

On Dec 09, shlomo.swidler@stripped wrote:
> Hi, I'm looking for documentation about the structure of the record
> data stored in the MYD file. There is a very brief (and unclear)
> section on it here: http://forge.mysql.com/wiki/MySQL_Internals_MyISAM
> , but I need more.
> 
> I'm looking to determine what the offset into the record is for each
> field in the row, and I see that there is an extra byte (or more)
>  present at the beginning if any of the field are allowed to contain
> null. Where in the C data structures is the info about when this byte
> is present in the record, so I can take it into account when
> extracting the field data from the record bytes?

You cannot really know it. SQL layer has the information about fields,
their types, and offsets in the row. MyISAM will create a dummy field
where this "null bitmap" is stored. If you compare the output of
myisamchk -dvv and SHOW CREATE TABLE you'll see that myisamchk can show
one field more than the table contains (from the SQL point of view).

But MyISAM doesn't really know (or care) if this field a "real" one or
it was only created to provide storage space for NULL bits.

There's no way you can find it out (in a general case) by looking only
at MyISAM files.
 
Regards / Mit vielen Grüssen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Developer
/_/  /_/\_, /___/\___\_\___/  MySQL GmbH, Dachauer Str. 37, D-80335 München
       <___/                  Geschäftsführer: Kaj Arnö - HRB
München 162140
Thread
More documentation about MYD record file structreshlomo.swidler9 Dec
  • Re: More documentation about MYD record file structreSergei Golubchik10 Dec
    • Re: More documentation about MYD record file structreshlomo.swidler10 Dec
      • Re: More documentation about MYD record file structreSergei Golubchik11 Dec