当前位置:网站首页>B+ tree (5) introduction to MyISAM -- MySQL from getting started to mastering (17)
B+ tree (5) introduction to MyISAM -- MySQL from getting started to mastering (17)
2022-07-26 13:17:00 【User 9919783】
In the last article, we said , A federated index uses more than two columns to create an index ,b+ The tree is a , First use c2 Column sorting , If the result is the same , Then use c3 Sort .innoDB Of b+ The characteristic of tree is that the root node remains unchanged , The new table has a clustered index by default , First, there is a root node without data , Put the user record data into the root points , When the data is slow , Page splitting , There will be many nodes , At this moment, the root node evolves into a root directory record node , Data is stored in the underlying node . The inner nodes of the secondary index ensure consistency , Add a primary key when saving column values .
B+ Trees (4) Joint index --mysql From entry to mastery ( sixteen )
myISAM brief introduction
We know innoDB The index of search engine is data , It is divided into list value index tree , And clustered index tree , Cluster index that b+ A tree index is data , All user records exist in leaf nodes . and myISAM Although it is also B+ Trees , But indexes and data are separate .
myISAM Yes, the user record data is all put in one file , It's called a data file , This file will not be divided into several pages , Just stuff as many records as you have , Through the corresponding line number of each line, you can quickly access , Because it is inserted at will , It will not be sorted by primary key size , Cannot use binary search method to find .
Then the index information will be stored in another index file ,myISAM The index will be created separately for the primary key of the table , Only the user record data is not stored in the leaf node , It's the primary key + Line number , It means that after finding the corresponding line number , I will use the line number to find all the data in the data file again . therefore myISAM Every query must be returned to the table , Equivalent to secondary index .(innoDB The cluster index of is to find the corresponding inner node directly in the root directory record page according to the primary key , Find all the data on the corresponding underlying leaf node ).
If necessary , You can also create secondary indexes or joint indexes , Only the leaf node stores column values + Line number .
Create index and delete index :
So much theoretical knowledge , How to fight in practice ?mysql Medium innoDB and myISAM The table will automatically be the primary key or declared as unique To create a clustered index , But if you need to create secondary indexes for other columns , You need to in sql Show indication in . Why not create it automatically , Don't forget that more indexes mean more b+ Trees , It means that both insert and delete require huge memory to maintain b+ Trees , It's very performance intensive .
When creating tables, you can create indexes ,index and key Keywords can be used , Appoint indx_tb_col Tabular c2 As a idx_c2 Index of names :
create table index_tb_col(
c1 int,
c2 int,
c3 char(1),
index idx_c2 (c2)
)row_format=Compact;Or after the table is created , Appoint c3 by idx_c3 Index of names :
mysql> alter table index_tb_col add index idx_c3 (c3);
Query OK, 0 rows affected (0.04 sec)You can also add federated indexes and delete indexes :
// Composite index
mysql> create table index_tb_col(
-> c1 int,
-> c2 int,
-> c3 char(1),
-> primary key (c1),
-> index idx_c2_c3 (c2,c3)
-> )row_format=Compact;
Query OK, 0 rows affected (0.03 sec)
// Delete index
mysql> alter table index_tb_col drop index idx_c2_c3;
Query OK, 0 rows affected (0.03 sec)边栏推荐
- Flutter prevents scientific counting and removes mantissa invalid 0
- 一笔画问题(中国邮递员问题)
- vector的一些实用操作
- panic: Error 1045: Access denied for user ‘root‘@‘117.61.242.215‘ (using password: YES)
- 解决方案丨5G技术助力搭建智慧园区
- The difference between $route and $route
- 被罚“带薪休假”一个月后,谷歌解雇了“爱”上 AI 的他
- JVM: what does the class loading subsystem do? What is it made of? What eight part essay do you need to remember?
- Detailed explanation of redis's single login
- 高通再次「押宝」中科创达,挑战智能驾驶软硬件全栈方案
猜你喜欢
![[typescript] typescript common types (Part 2)](/img/6b/2ac07f16af044bdfb719753ae241cc.png)
[typescript] typescript common types (Part 2)

One stroke problem (Chinese postman problem)

0基础编程资源大全(先收藏~慢慢看~)

Version of NDK matched the requested version 21.0.6113669. versions available locally: 2

Kubernetes flannel: host-gw mode

How to face scientific and technological unemployment?

Today in history: IBM obtained the first patent; Verizon acquires Yahoo; Amazon releases fire phone

Kubernetes apiserver current limiting strategy

A college archives management system based on asp.net
![[5g] what are Cu and Du in 5g?](/img/5b/3453ade88ded4593edfcba9beb8ada.jpg)
[5g] what are Cu and Du in 5g?
随机推荐
Hcip day 11 comparison (BGP configuration and release)
Today in history: IBM obtained the first patent; Verizon acquires Yahoo; Amazon releases fire phone
Huawei recruited "talented teenagers" twice this year; 5.4 million twitter account information was leaked, with a selling price of $30000; Google fired engineers who believed in AI consciousness | gee
Detailed explanation of redis's single login
如何构建以客户为中心的产品蓝图:来自首席技术官的建议
Use float to realize left, middle and right layout, and the middle content is adaptive
Mysql数据目录(3)---表数据结构myISAM(二十六)
The best engineer was "forced" away by you like this!
【花雕动手做】有趣好玩的音乐可视化系列小项目(12)---米管快速节奏灯
Kubelet CRI container runtime
Learn about Pinia state getters actions plugins
同花顺开的账户安全吗?
JVM: what does the class loading subsystem do? What is it made of? What eight part essay do you need to remember?
目标检测网络R-CNN 系列
Mysql数据目录(2)---表数据结构(二十五)
Incorrect use of parentdatawidget when the exception was thrown, this was the stack:
AI-理论-知识图谱1-基础
12 brand management of commodity system in gulimall background management
How to remove underline and color when there is focus in the shutter textfield
MySQL可以自定义变参存储函数吗?