当前位置:网站首页>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 .
边栏推荐
- 【Mongodb】READ_ ME_ TO_ RECOVER_ YOUR_ Data, the database is deleted maliciously
- docker安装mysql-简单无坑
- [Wuhan University] information sharing of the first and second postgraduate entrance examinations
- Financial management [1]
- laravel 验证器的使用
- vulnhub Vegeta: 1
- laravel model 注意事项
- Financial management [3]
- It's hard to hear C language? Why don't you take a look at my article (7) input and output
- 环境配置 | VS2017配置OpenMesh源码和环境
猜你喜欢

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

The difference between interceptor and filter

EPICS记录参考2--EPICS过程数据库概念
![[untitled]](/img/ed/847e678e5a652da74d04722bbd99ff.jpg)
[untitled]

Solution to the login error of tangdou people

vulnhub Vegeta: 1

07_ Springboot for restful style

07_SpingBoot 实现 RESTful 风格

Some updates about a hand slider (6-18, JS reverse)

加分利器 不负所托 | 知道创宇获攻防演练防守方感谢信!
随机推荐
Research Report on solar battery charger industry - market status analysis and development prospect forecast
Accounting standards for business enterprises application [5]
Selection (027) - what is the output of the following code?
EPICS record Reference 3 - - field available for all Records
记录一下MySql update会锁定哪些范围的数据
「ARM 架构」是一种怎样的处理器架构?
Epics record reference 4 -- fields for all input records and fields for all output records
Docker installation redis- simple without pit
MySQL kills 10 people. How many questions can you hold on to?
Selection (029) - what is the output of the following code?
Vulnhub Vegeta: 1
Mycms we media CMS V3.0, resource push optimization, new free template
Database transaction Transanction
Servlet
对抗训练理论分析:自适应步长快速对抗训练
2022年安全员-A证考题及答案
Research and investment strategy report on China's nano silver wire conductive film industry (2022 Edition)
Development specification - parameter verification exception, exception return prompt section
Cat write multiline content to file
Research Report on research and investment prospects of China's container coating industry (2022 Edition)