mysql - 为什么 MySQL 中外部存储的 blob 需要 20 字节的指针?

标签 mysql database blob

在 MySQL 5.6 中,我遇到了以下问题:

For tables created in ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED, the values of BLOB, TEXT or VARCHAR columns may be stored fully off-page, depending on their length and the length of the entire row. For columns that are stored off-page, the clustered index record only contains 20-byte pointers to the overflow pages, one per column.

为什么外部存储的 blob 需要 20 字节的指针?我不认为地址空间会这么大。

最佳答案

行内存储的数据定义如下:

https://github.com/jeremycole/mysql/blob/master/storage/innobase/include/btr0cur.h#L762

它写在这里:

https://github.com/jeremycole/mysql/blob/master/storage/innobase/btr/btr0cur.c#L4504

因此写入的字段为(总共 20 个字节):

  • 空间 ID(4 字节):有点多余。
  • 页码(4 字节):非常重要的部分。
  • 页面偏移(4 个字节):页面内写入的小 header 的偏移量,也有点多余,因为整个页面都会被占用。
  • 数据长度(8字节):外部写入数据的总长度。

关于mysql - 为什么 MySQL 中外部存储的 blob 需要 20 字节的指针?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16845293/

相关文章:

mysql - SQL_BIG_SELECTS 错误

mysql - 如何更新 phpmyadmin 中的日期时间字段

mysql - 如何将 MySQL count(*) 与 Order by 子句和 limit 一起使用?

php - SELECT 语句不能正常工作

php - 如何用php管理cookies

java - 如何使用 Java 在 CouchDB 中存储 Blob?

mysql - 除非指定主键,否则防止从表中删除 *

sql-server - 数据库代码不再有效

android - 当我从 SQLite 中检索 blob 值时,它会给出不同的值,因为它存储在数据库中

javascript - 如何在不下载的情况下将谷歌字体加载到 chrome 打包的应用程序中?