当前位置:网站首页>MySQL -- index of InnoDB storage engine
MySQL -- index of InnoDB storage engine
2022-07-01 22:54:00 【Xiao Xian.】
Recommended links :
summary ——》【Java】
summary ——》【Mysql】
summary ——》【Spring】
summary ——》【SpringBoot】
Mysql——》Innodb Index of storage engine
One 、 file
frm: Table structure file
ibd: Data is index
Q: Why do you mean InnoDB Index is data , Data is index ?
A: stay InnoDB Inside , It uses primary key as index to organize data storage , So the index file and the data file are the same
Pieces of , All in .ibd In the document . stay InnoDB On the leaf node of the primary key index , It stores our data directly .
Q: a sheet InnoDB Your table may have many multiple indexes , There must be only one copy of the data , Which index leaf node is the data on ?
A: There is a clustered index / Cluster index
Two 、 Clustered index / Cluster index / primary key
If a table has both primary key indexes and other indexes :
primary key : It's a clustered index , Determine the physical storage order of data rows , Leaf nodes store data
Other indexes : It's a secondary index / Secondary index , The leaf node stores the value of the primary key
Definition : The logical order of index key values is consistent with the physical storage order of table data rows .
Example : The list of dictionaries is sorted by pinyin , The content is also sorted by Pinyin , This kind of directory sorted by pinyin is called clustered index .
3、 ... and 、 Secondary indexes / Secondary index
When I People use name Cable lead check Inquiry One strip remember record , it Meeting stay Two level Cable lead Of leaf Son section spot look for To name=bobo, Get the primary key value id=1, Then go to the leaf node of the primary key index to get the data .
From this perspective , Because the primary key index scans one tree less than the secondary index B+Tree, Its speed will be relatively faster .

Four 、 If there is no primary key or index in the table , Where is the data stored ?
Reference link :【 Official website 】innodb-index-types
1、 If we define a primary key (PRIMARY KEY), that InnoDB Will choose the primary key as the clustered index .
2、 If the primary key is not explicitly defined , be InnoDB Will choose the first one that does not contain NULL The unique index of the value is used as the primary key index
lead .
3、 If there is no such unique index , be InnoDB Will choose built-in 6 Byte long ROWID As a hidden clustered index ,
It will increase the primary key as the row record is written .
边栏推荐
- [untitled]
- Rust语言——小小白的入门学习05
- 元宇宙可能成为互联网发展的新方向
- Tourism Management System
- 104. SAP UI5 表格控件的支持复选(Multi-Select)以及如何用代码一次选中多个表格行项目
- 447-哔哩哔哩面经1
- SAP ui5 application development tutorial 104 - multi select support for SAP ui5 table controls and how to use code to select multiple table row items at a time
- Turn -- go deep into Lua scripting language, so that you can thoroughly understand the debugging principle
- twenty million two hundred and twenty thousand seven hundred and one
- Intelligent computing architecture design of Internet
猜你喜欢

vSphere+、vSAN+来了!VMware 混合云聚焦:原生、快速迁移、混合负载

【无标题】

Digital currency: far-reaching innovation

447 Bili Bili noodles warp 1

Slope compensation

rxjs Observable of 操作符的单步调试分析

MySQL5.7 设置密码策略(等保三级密码改造)

Flynk SQL client uses comparison and is familiar with official documents

使用 Three.js 实现'雪糕'地球,让地球也凉爽一夏

今日睡眠质量记录71分
随机推荐
转--拿来即用:分享一个检查内存泄漏的小工具
Understanding of transactions in MySQL
cvpr2022 human pose estiamtion
redis配置文件中常用配置详解[通俗易懂]
The fixed assets management subsystem reports are divided into what categories and which accounts are included
Resttemplate remote call tool class
台积电全球员工薪酬中位数约46万,CEO约899万;苹果上调日本的 iPhone 售价 ;Vim 9.0 发布|极客头条
阿洛迷茫后的思考
Hide the creation and use of users
internal field separator
Awoo's favorite problem (priority queue)
Arlo's thinking after confusion
447-哔哩哔哩面经1
激发新动能 多地发力数字经济
Appium自动化测试基础 — 补充:Desired Capabilities参数介绍
nn. Parameter] pytoch feature fusion adaptive weight setting (learnable weight use)
Rust语言——小小白的入门学习05
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received
3DE resources have nothing or nothing wrong
Operation category read is not supported in state standby