技术开发 频道

MYISAM 动态格式数据存储结构

  2.用多个字段来分析行数据:

  drop table if exists heyf_5 ;

  create table heyf_5 (id int ,name varchar(50),id1 int ) type myisam ;

  insert into heyf_5 values (100,'aaa',3),(2,'bb',12),(3,'c',4);

  system hexdump /opt/mysql/data/test/heyf_5.MYD

  ==================================================

  0000000 0003 020e f800 0064 0000 6103 6161 0003

  0000010 0000 0000 0003 030d f800 0002 0000 6202

  0000020 0c62 0000 0000 0000 0003 040c f800 0003

  0000030 0000 6301 0004 0000 0000 0000

  ==================================================

  ROW1: 0003 020e f800 0001 0000 6103 6161 0003 0000 0000

  转换成:

  03 00 0e 02 00 f8 01 00 00 00 03 61 61 61 03 00 00 00 00 00

  其中:

  -----------------------------------------

  03 : type

  00 0e : 13 = 4(int)+[ 3+2 (varchar)] + 4(int)

  02 : 空闲空间2个

  00 f8 : 1111 1000 --> 表示三个字段,并不为NULL

  下面为具体的数据:

  01 00 00 00 : INT 4B 值为1

  03 61 61 61 : 因为是变长,03表示这个值的长度,后面跟具体的值

  03 00 00 00 : INT 4B 值为3

  -----------------------------------------

0
相关文章