1.3 我们验证上面的假设:
update heyf_5 set name='aaaaaa' where name='a';
update heyf_5 set name= null where name='b';
[root@alisoft-test1 test]# system hexdump /opt/mysql/data/test/heyf_5.MYD
-------------------------------------------------
0000000 0003 0808 06fe 6161 6161 6161 0000 0000
0000010 0000 0000 0003 0e02 00ff 0000 0000 0000
0000020 0000 0000 0000 0000 0003 0d03 01fe 0063
0000030 0000 0000 0000 0000 0000 0000
取出第1行数据:
0003 0808 06fe 6161 6161 6161 0000 0000 0000 0000
转换一下:
03 00 08 08 fe 06 61 61 61 61 61 61 00 00 00 00 00 00 00 00
其中:
------------------------------------
03 : start of header - Block type
00 08 : 实际字符长度 = 6+2 B
08 : 未使用的空间: 8 B
fe : flags (0 表示不为null,1表示为null)
06 : 该行中该字段实际数据的长度6
61 61 : 实际存储的值: 'aa'
00 : 未使用的空间(刚好8个)
取出第2行数据:
0003 0e02 00ff 0000 0000 0000 0000 0000 0000 0000
转换一下:
03 00 02 0e ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
其中:
------------------------------------
03 : start of header - Block type
00 02 : 实际字符长度 = 0+2 B
0e : 未使用的空间: 14 B
ff : --> 1111 1111 因为只有一个字段,标志用最后1位为表示,是1表示为NULL
00 : 该行中该字段实际数据的长度 0
00 ... : 未使用的空间(刚好14个)