Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于 MySQL 一行记录是怎么存储的? 中 变长字段长度 的判断条件的疑问。 #209

Open
CatNum opened this issue Feb 8, 2024 · 0 comments

Comments

@CatNum
Copy link

CatNum commented Feb 8, 2024

文章:MySQL 一行记录是怎么存储的?

官方文档中,描述如下:

For each non-NULL variable-length field, the record header contains the length of the column in one or two bytes. Two bytes are only needed if part of the column is stored externally in overflow pages or the maximum length exceeds 255 bytes and the actual length exceeds 127 bytes. For an externally stored column, the 2-byte length indicates the length of the internally stored part plus the 20-byte pointer to the externally stored part. The internal part is 768 bytes, so the length is 768+20. The 20-byte pointer stores the true length of the column.
对于每个非NULL可变长度字段,记录头包含一或两个字节的列长度。仅当列的部分内容存储在溢出页中或最大长度超过 255 字节且实际长度超过 127 字节时,才需要两个字节。对于外部存储列,2字节长度表示内部存储部分的长度加上指向外部存储部分的20字节指针的长度。内部部分为768字节,所以长度为768+20。20 字节指针存储列的真实长度。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant