14.8.3 Physical Row Structure of InnoDB Tables  InnoDB 表的物理行结构

一个InnoDB 表的物理行结构取决于在创建表指定的行格式

默认, InnoDB 使用Antelope file format 和它的COMPACT 行格式。

REDUNDANT format 是可用的来保持兼容性和MySQL 老的版本。

当你启用 innodb_file_per_table setting, 你也可以使用新的Barracuda file format, 

使用它的DYNAMIC and COMPRESSED row formats。

检查InnoDB表的行格式,你可以使用SHOW TABLE STATUS. For example: 

mysql> SHOW TABLE STATUS IN test1\G
*************************** 1. row ***************************
Name: t1
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 16384
Data_free: 0
Auto_increment: 1
Create_time: 2014-10-31 16:02:01
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment: 你也可以检查InnoDB表的行格式通过查询INFORMATION_SCHEMA.INNODB_SYS_TABLES. mysql> SELECT NAME, ROW_FORMAT FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME='test1/t1';
+----------+------------+
| NAME | ROW_FORMAT |
+----------+------------+
| test1/t1 | Compact |
+----------+------------+ Redundant Row Format Characteristics 荣誉行格式特性: 在InnoDB 表使用 REDUNDANT row format 有下面的特点: 1. 每个index 记录包含一个6字节的header,header 是用于把连续的记录连接起来,也用于 row-level locking. 2.记录在 clustered index 包含字段用于所有用户定义的列,此外,有一个6个字节的 transaction ID field 和一个7个字节的指针字段 3.如果一个表没有定义主键, 每个clustered index record 也包含一个6字节的row ID字段 4.每个secondary index record 也包含所有的主键字段 定义用于clustered index key 5.一个记录包含一个支点到每个记录的字段,如果字段的总长度在一个记录是小于128字节,指针是1个字节 否则 指针是2个字节。 这些指针的数组被称为记录目录,这些指针指向区域被称为 记录的数据部分 6. 在内部, InnoDB 存储固定长度的字符串列 比如CHAR(10) 以一个固定长度格式。 InnoDB 不会截断VARCHAR列两侧的空格 7.InnoDB 编码固定长度字段大于或者等于768字节 8.一个SQL NULL 值存储一个或者2个字节在记录目录。 除此之外, 一个SQL NULL 值 存储0个字节在记录的数据部分 如果存储在可变成都列。 在一个固定长度列,他存储列的固定长度在记录的数据部分。 COMPACT Row Format Characteristics 紧凑的行格式 COMPACT row format 降低了约20%的行存储空间相比 REDUNDANT format 增加了CPU 使用对于一些操作。 如果你的负载时是典型的受限于cahce 命中率和磁盘速度, COMPACT format 是看起来更快的。 如果你的负载是受限于CPU 速度,compact format 可能会更慢 在InnoDB 表中使用COMPACT row format 有下面的特点: 1. 每个index record 包含一个5个字节的header 通过一个可变长度的header , header是用于把联系的记录连接起来,也用于row-level locking 2. 记录header 是跟在非NULL列的数据内容的后面 3.记录在 clustered index 包含字段用于所有用户定义的列,此外, 有一个6字节的事务ID 字段和一个7字节的指针字段 4. 如果表没有一个主键,每个clustered index record 也包含一个6字节的row id字段 5.每个secondary index record 也包含所有的主键字段 定义用于clustered index key 如果任何主键字段是可变长度, record header对于每个 secondary index 有一个可变部分来记录它们的长度,即使 secondary index 是定义在可变长度列 6.InnoDB 不截断去掉 VARCHAE列两侧的空格

14.8.3 Physical Row Structure of InnoDB Tables InnoDB 表的物理行结构的更多相关文章

  1. 14.2.5.7 Physical Row Structure 物理数据结构:

    14.2.5.7 Physical Row Structure 物理数据结构: InnoDB物理记录结构依赖行格式 在表创建的时候, 默认, InnoDB 使用Antelope 文件存储格式和它的压缩 ...

  2. 14.6.7?Limits on InnoDB Tables InnoDB 表的限制

    14.6.7?Limits on InnoDB Tables InnoDB 表的限制 警告: 不要把MySQL system tables 从MyISAM 到InnoDB 表. 这是不支持的操作,如果 ...

  3. 14.8.2 Role of the .frm File for InnoDB Tables InnoDB 表得到 .frm文件的作用

    14.8.2 Role of the .frm File for InnoDB Tables InnoDB 表得到 .frm文件的作用 Vsftp:/data01/mysql/zjzc# ls -lt ...

  4. 14.2.5.1 Role of the .frm File for InnoDB Tables InnoDB .frm文件的作用

    14.2.5.1 Role of the .frm File for InnoDB Tables: 14.2.5.1 Role of the .frm File for InnoDB Tables I ...

  5. InnoDB存储引擎表的逻辑存储结构

    1.索引组织表:     在InnoDB存储引擎中,表都是依照主键顺序组织存放的.这样的存储方式的表称为索引组织表,在innodb存储引擎表中,每张表都有主键.假设创建的时候没有显式定义主键,则Inn ...

  6. Limits on Table Column Count and Row Size Databases and Tables Table Size 最大行数

    MySQL :: MySQL 8.0 Reference Manual :: C.10.4 Limits on Table Column Count and Row Size https://dev. ...

  7. mysql的innodb 引擎 表锁与行锁

    innodb 引擎 行锁与表锁 行锁与表锁是基于索引来说的(且索引要生效) 不带索引 (表锁)要全表扫描 1. 执行select @@autocommit; 查看结果 0是不自动提交事务,1是自动提交 ...

  8. 14.2.5.4 Physical Structure of an InnoDB Index InnoDB Index 的物理结构

    14.2.5.4 Physical Structure of an InnoDB Index InnoDB Index 的物理结构 所有的InnoDB indexes 是B-trees ,index ...

  9. 14.8.11 Physical Structure of an InnoDB Index InnoDB Index 的物理结构

    14.8.11 Physical Structure of an InnoDB Index InnoDB Index 的物理结构 所有的InnoDB indexes 是 B-trees Index r ...

随机推荐

  1. IIS Shared Configuration

    Introduction The Internet changes the ways in which companies handle their day-to-day business and h ...

  2. Windows Server 2008中关闭事件跟踪程序的方法

    Windows Server 2008跟Windows Server 2003一样,在关机的时候会弹出一个“关闭事件跟踪程序”窗口,当然微软这么做是处于安全的考虑啦,但是如果我们只是个人用用的话,那就 ...

  3. C# addin 开发心得记录

    1.环境 2012 新建项目-2010外接程序 2.新建项-功能区  创建菜单等 发布: 1.InstallShield  2015 2.打包 说明按地址-https://msdn.microsoft ...

  4. HttpWebRequest结合HtmlAgilityPack实现网页form提交

    年前一个项目,需要在某个系统实现系统自动操作. 系统页面使用form提交,页面参数较多,也参数设计一系列计算逻辑,改动一个值,其他值自动改变. 传统方法使用正则表达式匹配参数,构建post参数进行请求 ...

  5. PHP四种传参方式

    test1界面: <html> <head> <title>testPHP</title> <meta http-equiv = "co ...

  6. gitlab 配置 ssh && ubuntu

    1,在你的电脑上生成密钥ssh-keygen -t rsa -C "youeamil@explode.com" 2,在 ubuntu系统中 ~/.ssh目录中生成了两个文件id_r ...

  7. JS 时间格式化函数

    //时间格式化函数 Date.prototype.format = function (format) { var o = { "M+": this.getMonth() + 1, ...

  8. 标准web架构分层

    标准Web系统的架构分层 转载:http://blog.csdn.net/yinwenjie    http://blog.csdn.net/yinwenjie/article/details/464 ...

  9. DataGrid列的合并

    /// <summary> /// DataGrid列的合并 /// 注意:1.DataGrid在绑定的时候进行分组和排序,才能让相同的行放在一起 /// 2.方法应用的时机,应该在Dat ...

  10. A题笔记(6)

    No. 3040 代码量好少,主要考到数学知识 唯一需要注意的是变量的类型 int -2147483648 ~ +2147483647 (4 Bytes) long 在32位机器中 int 类型 和 ...