MYSQL 索引页 结构图

时间:2021-11-24 22:31:14
create table t( a int() not null auto_increment,b char() default null,primary key(a));
mysql> select * from t;
+----+------+
| a | b |
+----+------+
| | aaa |
| | bbb |
| | ccc |
| | ddd |
| | eee |
| | fff |
| | ggg |
| | hhh |
| | iii |
| | jjj |
+----+------+
rows in set (0.00 sec)
hexdump -C t.ibd

MYSQL 索引页 结构图

MYSQL 索引页 结构图

锁结构与索引页对比

RECORD LOCKS space id  page no  n bits  index `PRIMARY` of table `test`.`t` trx id  lock_mode X
Record lock, heap no PHYSICAL RECORD: n_fields ; compact format; info bits
: len ; hex 73757072656d756d; asc supremum;; Record lock, heap no PHYSICAL RECORD: n_fields ; compact format; info bits
: len ; hex ; asc ;;
: len ; hex 000000007c12; asc | ;;
: len ; hex 8f000001460110; asc F ;;
: len ; hex ; asc aaa;; Record lock, heap no PHYSICAL RECORD: n_fields ; compact format; info bits
: len ; hex ; asc ;;
: len ; hex 000000007c13; asc | ;;
: len ; hex 90000001b70110; asc ;;
: len ; hex ; asc bbb;; Record lock, heap no PHYSICAL RECORD: n_fields ; compact format; info bits
: len ; hex ; asc ;;
: len ; hex 000000007c18; asc | ;;
: len ; hex 93000001b80110; asc ;;
: len ; hex ; asc ccc;; Record lock, heap no PHYSICAL RECORD: n_fields ; compact format; info bits
: len ; hex ; asc ;;
: len ; hex 000000007c19; asc | ;;
: len ; hex 940000020a0110; asc ;;
: len ; hex ; asc ddd;; Record lock, heap no PHYSICAL RECORD: n_fields ; compact format; info bits
: len ; hex ; asc ;;
: len ; hex 000000007c1a; asc | ;;
: len ; hex 950000014b0110; asc K ;;
: len ; hex ; asc eee;; Record lock, heap no PHYSICAL RECORD: n_fields ; compact format; info bits
: len ; hex ; asc ;;
: len ; hex 000000007c1b; asc | ;;
: len ; hex 960000014c0110; asc L ;;
: len ; hex ; asc fff;; Record lock, heap no PHYSICAL RECORD: n_fields ; compact format; info bits
: len ; hex ; asc ;;
: len ; hex 000000007c20; asc | ;;
: len ; hex 99000001a10110; asc ;;
: len ; hex ; asc ggg;; Record lock, heap no PHYSICAL RECORD: n_fields ; compact format; info bits
: len ; hex ; asc ;;
: len ; hex 000000007c21; asc |!;;
: len ; hex 9a0000014f0110; asc O ;;
: len ; hex ; asc hhh;; Record lock, heap no PHYSICAL RECORD: n_fields ; compact format; info bits
: len ; hex ; asc ;;
: len ; hex 000000007c22; asc |";;
: len ; hex 9b000001500110; asc P ;;
: len ; hex ; asc iii;; Record lock, heap no PHYSICAL RECORD: n_fields ; compact format; info bits
: len ; hex 8000000a; asc ;;
: len ; hex 000000007c23; asc |#;;
: len ; hex 9c000001a40110; asc ;;
: len ; hex 6a6a6a; asc jjj;;