解析:
数据行头如下:
Field Type Length Description
t_xmin TransactionId 4 bytes insert XID stamp
t_xmax TransactionId 4 bytes delete XID stamp
t_cid CommandId 4 bytes insert and/or delete CID stamp (overlays with t_xvac)
t_xvac TransactionId 4 bytes XID for VACUUM operation moving a row version
t_ctid ItemPointerData 6 bytes current TID of this or newer row version
t_infomask2 uint16 2 bytes number of attributes, plus various flag bits
t_infomask uint16 2 bytes various flag bits
t_hoff uint8 1 byte offset to user data
解析:
An item identifier contains a byte-offset to the start of an item, its length in bytes, and a few attribute bits which affect its interpretation
简单说,行指针占4个字节,32位,具体包含如下:
1.行内容的偏移量,占15个位
2.行内容的长度,占15个位
3.指针的标志,占2个位
尤其注意,行内容的偏移量和行内容的位置,不是一个概念,行内容的偏移量是指行在页内的位置,可以通过行指针快速定位到行数据;行内容的位置是指行数据在磁盘上的位置,所以本题选择 B.
A. 块的checksum值
B. 空闲空间的真实位置和结束位置
C. 特殊数据的其实位置
D. 数据块的位置
答案: D
解析:
下面列出页头内容,不包含块的位置。
field Type Length Description
pd_lsn PageXLogRecPtr 8 bytes LSN: next byte after last byte of WAL record for last change to this page
pd_checksum uint16 2 bytes Page checksum
pd_flags uint16 2 bytes Flag bits
pd_lower LocationIndex 2 bytes Offset to start of free space
pd_upper LocationIndex 2 bytes Offset to end of free space
pd_special LocationIndex 2 bytes Offset to start of special space
pd_pagesize_version uint16 2 bytes Page size and layout version number information
pd_prune_xid TransactionId 4 bytes Oldest unpruned XMAX on page, or zero if none