Number of B+TREE layers of innodb

View employee_1 table

desc employee_1

 

 

Total number

select count(*) from employee_1

View related table information in information_schema

Pay attention to the PAGE_NO and: index_id of the index

SELECT b.name, a.name, index_id, type, a.space, a.PAGE_NO 
FROM information_schema.INNODB_SYS_INDEXES a, information_schema.INNODB_SYS_TABLES b 
WHERE a.table_id = b.table_id AND a.space <> 0 and b.name='king/employee_1'

 

View innodb page size

show global variables like 'innodb_page_size';

 

Tablespace directory

/var/lib/mysql/king

# -s  从偏移量开始输出
# -n  前10个字节
hexdump -s 49216 -n 10 ./employee_1.ibd

000c040 0200 0000 0000 0000 6600
000c04a

It can be found that the PAGE_LEVEL of the primary key index (PRIMARY) is 0200 , indicating that the height of the secondary index tree is 3

Note: 49216 in hexdump, this number corresponds to the index of the employee_1 table. The
formula is page_no * innodb_page_size + 64
PRIMARY:(16384*3)+64=49216. 
At the same time, you can observe 6600 in the hexdump result. This number is 66 in hexadecimal. Converted to decimal is: 102, which corresponds to the index_id in the information_schema respectively.

 

Reference documents

 https://www.cnblogs.com/2woods/p/9978011.html

 

 

Guess you like

Origin blog.csdn.net/kq1983/article/details/114970089