技术开发 频道

MYISAM 静态格式数据存储结构

  3. 如果字段类型为: NOT NULL

  drop table if exists heyf_5 ;

  create table heyf_5 (id int not null, name char(10) not null ,addr char(20) not null) engine myisam ;

  insert into heyf_5 values (12,'hyf','street-1') ,(13,'steven','street-2') ;

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

  0000000 0cff 0000 6800 6679 2020 2020 2020 7320

  0000010 7274 6565 2d74 2031 2020 2020 2020 2020

  0000020 2020 ff20 000d 0000 7473 7665 6e65 2020

  0000030 2020 7473 6572 7465 322d 2020 2020 2020

  0000040 2020 2020 2020

  对比1.1的测试数据,Header位发生了变化.

  1111 0001 --> 1111 1111

  查资料了解到:

  固定格式行的Header,是用来标识那些可空字段的实际值是否为NULL,如果是NULL,则填1.否则填0.

  如果表中没有"可NULL"字段,那么header="ff"

  Header长度= (1 + number of NULL columns + 7) / 8 bytes

0
相关文章