当前位置:网站首页>Dig deep into MySQL - resolve the non clustered index of MyISAM storage engine
Dig deep into MySQL - resolve the non clustered index of MyISAM storage engine
2022-06-24 23:09:00 【Little Camellia girl】
stay InnoDB Index is data , That is, the cluster index B+ The leaf node of the tree already contains all the complete user records .MyISAM Although the index scheme also uses tree structure , But the index and data are stored separately , This index is also called non clustered index .
create table index_demo(
c1 int,
c2 int,
c3 char(1),
primary key(c1)
) ROW_FORMAT=COMPACT;
The records in the table are stored separately in a file according to the insertion order of records , This file is not divided into several data pages , As many records as there are, insert as many records into this file , thus , We can quickly access a record through the line number . Use... In the table MyISAM As a storage engine , The representation of its records in the storage space is shown in figure :
Because there is no deliberate sorting according to the primary key size when inserting data , So we can't use dichotomy to find these data , Use MyISAM The table of the storage engine will store the index information separately in another file , It's called an index file .MyISAM A separate index will be created for the primary key of the table , However, the leaf node of the index does not store complete user records , It's a combination of primary key value and line number . That is, first find the corresponding line number through the index , Then find the corresponding record through the line number .
stay InnoDB In the storage engine , We only need to search the cluster index once according to the primary key value to find the corresponding record ; stay MyISAM In the storage engine , A table return operation is required , It also means that MyISAM The indexes established in are equivalent to all secondary indexes .
MyISAM The address offset of the record in the data file will be stored directly at the index leaf node . From this we can see that MyISAM The operation of returning the table is very fast , Because it takes the address offset directly to the file to get data , and InnoDB It is to find records in the cluster index after obtaining the primary key , Although it's not slow , But it's not as good as directly using an address to access .
If necessary , We can also index other columns separately or jointly , Its principle and InnoDB The index is almost the same , Only the corresponding columns are stored at the leaf node + Line number , These index pages are all secondary indexes .
You can see that for non clustered indexes , Whether the sorting rule is primary key or non primary key , Its structure is the same , That is, the leaf node stores the corresponding columns + Line number .
边栏推荐
- Win10 or win11 printer cannot print
- How to submit the shopee opening and settlement flow?
- LeetCode Algorithm 剑指 Offer 52. 两个链表的第一个公共节点
- 剑指 Offer 42. 连续子数组的最大和
- Memory alignment of structures
- 【nvm】
- Common sense of resolution
- 记录一下MySql update会锁定哪些范围的数据
- China solar thermal market trend report, technical dynamic innovation and market forecast
- 大厂面试必问:如何解决TCP可靠传输问题?8张图带你详细学习
猜你喜欢

环境配置 | VS2017配置OpenMesh源码和环境

Non single file component

Stop using it indiscriminately. This is the real difference between @validated and @valid!!!

go Cobra命令行工具入门

Epics record reference 4 -- fields for all input records and fields for all output records

EMI的主要原因-工模电流

Attention, postgraduate candidates! They are the easiest scams to get caught during the preparation period?!

Epics record reference 2 -- epics process database concept

Tech Talk 活动回顾|云原生 DevOps 的 Kubernetes 技巧

Pousser l'information au format markdown vers le robot nail
随机推荐
JWT(Json Web Token)
A big factory interview must ask: how to solve the problem of TCP reliable transmission? 8 pictures for you to learn in detail
2022年安全员-A证考题及答案
记录一下MySql update会锁定哪些范围的数据
LeetCode Algorithm 剑指 Offer 52. 两个链表的第一个公共节点
Design and implementation of spark offline development framework
Selection (026) - what is the output of the following code?
gocolly-手册
JD 618 conference tablet ranking list announced that the new dark horse brand staff will compete for the top three, learning from Huawei, the leader of domestic products
Epics record reference 3 -- fields common to all records
vulnhub Vegeta: 1
关于某手滑块的一些更新(6-18,js逆向)
Selection (025) - what is the output of the following code?
Learn about redlock
京东618会议平板排行榜公布,新锐黑马品牌会参谋角逐前三名,向国货老大华为学习
Epics record reference 4 -- fields for all input records and fields for all output records
Servlet
2022年高处安装、维护、拆除考试模拟100题及模拟考试
Sword finger offer 42 Maximum sum of successive subarrays
Solve the problem of port occupation