做一下格式处理,添加标记:
19 17 15 13 0C 06 Field Start Offsets /* First Row */
00 00 78 0D 02 BF Extra Bytes
00 00 00 00 04 21 System Column #1
00 00 00 00 09 2A System Column #2
80 00 00 00 2D 00 84 System Column #3
50 50 Field1 'PP'
50 50 Field2 'PP'
50 50 Field3 'PP'
16 15 14 13 0C 06 Field Start Offsets /* Second Row */
00 00 80 0D 02 E1 Extra Bytes
00 00 00 00 04 22 System Column #1
00 00 00 00 09 2B System Column #2
80 00 00 00 2D 00 84 System Column #3
51 Field1 'Q'
51 Field2 'Q'
51 Field3 'Q'
94 94 14 13 0C 06 Field Start Offsets /* Third Row */
00 00 88 0D 00 74 Extra Bytes
00 00 00 00 04 23 System Column #1
00 00 00 00 09 2C System Column #2
80 00 00 00 2D 00 84 System Column #3
52 Field1 'R'
-- "Field Start Offsets"
参照First Row,从Extra Bytes开始的7个字段,大小分别为6, 6, 7, 2, 2, 2,偏移信息指向了下一字段的开始位置,16进制表示下的数字06, 0c (6+6), 13 (6+6+7), 15 (6+6+7+2), 17 (6+6+7+2+2), 19 (6+6+7+2+2+2),倒序的Field Start Offsets值分别为:[19,17,15,13,0c,06]
-- "Extra Bytes"
参照First Row,Extra Bytes为[00 00 78 0D 02 BF],参照EXTRA BYTES读取跳过头21 bit读(n_fields),取10个bit,读取第三个字节最后三个个bit [000]和第四个字节0D[00001101]的7个bit [0000110],得出的6即为字段的数量(除去Extra Bytes),第四个字节0D[00001101]最后bit:1表示byte_offs_flag说明偏移量为1字节,最后的第5,6字节02 BF,指向下一行Second Row(System Column #1)的记录(02BF为0D42BF页内地址),下一记录指向了System Column #1,读取过程遵循EXTRA BYTES末的规则。
-- NULL列的表示
参照Third Row,FIELD2和FIELD3为NULL,因为byte_offs_flag为1,因此,在Field Start Offsets中[94 94 14 13 0C 06]每次读取1个字节可表示字段的偏移信息,这个字节最高位为NULL标记,14 13表示1个字节[52]的FIELD1值'R',94 14表示0字节的FIELD2值NULL(94最高位为1表示NULL,其余7 bit为14),94 94表示0字节的FIELD3值NULL。
在MySQL的InnoDB存储引擎中count(*)函数的优化
MySQL InnoDB存储引擎锁机制实验