InnoDB-Rowformat-Compact 图解

it2023-02-12  47

测试表

mysql> show create table keys_order\G *************************** 1. row *************************** Table: keys_order Create Table: CREATE TABLE `keys_order` ( `id` int(11) NOT NULL, `name` varchar(10) NOT NULL, `age` int(11) DEFAULT NULL, PRIMARY KEY (`id`,`name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 1 row in set (0.00 sec)

注意这里特意设置了主键是由 id 和 name 组成。

测试数据

mysql> use xiaohaizi; mysql> select * from keys_order; +----+-------+------+ | id | name | age | +----+-------+------+ | 7 | seven | 7 | | 8 | eight | 8 | | 9 | nine | 9 | | 10 | ten | 10 | +----+-------+------+ 4 rows in set (0.00 sec)

数据目录查看表对应的独立表空间文件

mysql> show variables like 'datadir'; +---------------+-----------------+ | Variable_name | Value | +---------------+-----------------+ | datadir | /var/lib/mysql/ | +---------------+-----------------+ 1 row in set (0.00 sec)

cd /var/lib/mysql

cd ‘database_name’; xxd keys_order.ibd

图解分析 Row Format 之 Compact

最新回复(0)