当前位置:网站首页>Mysql database index
Mysql database index
2022-07-23 21:19:00 【InfoQ】
MySQL What are the conditions that do not go through the index ?
- The index column participates in the calculation ;
- The index column uses the function ;
- The matching value uses the first percent sign ;
- String and number comparison ;
- The leftmost prefix principle of joint index is not followed ;
- The engine believes that full table scanning is cheaper than using indexes
Three data models of index
- Hashtable : This structure of hash table is applicable to the scenario with only equivalent query MemCached etc. NoSQL engine
- Ordered array : The performance of ordered array in the scene of equivalent query and range query is excellent . The principle of using binary tree . The time complexity is O logN; But for updates , Low efficiency , So the ordered array index only applies to the static storage engine .
- Search tree : Binary tree -> Balanced binary trees -> Balance N Fork tree
About B+Tree
- primary key The leaf node stores the whole line of data ,InnoDB in , A primary key index is also called a clustered index (Clustered Index)
- Non primary key index The leaf node stores the value of the primary key .InnoDB in , Non primary key indexes are also called secondary indexes (Seconday Index)
- All leaf nodes are connected by linked list ,Easy to find and traverse the interval.B Trees need to be recursively traversed at every level . Adjacent elements may not be adjacent in memory , So cache life is neutral B+ Good tree .
- b+ The middle node of the tree does not save data , Can accommodate more node elements .
Index example
create table T(
id int primary key,
k int not null,
name varchar(16),
index (k))engine=InnoDB;
summary
边栏推荐
- 1061 Dating
- 如何在面试中介绍自己的项目经验
- 支付宝常用接口统一封装,可直接支付参数使用(适用于H5、PC、APP)
- 221. 最大正方形 ●● & 1277. 统计全为 1 的正方形子矩阵 ●●
- 【攻防世界WEB】难度四星12分进阶题:FlatScience
- WinDbg practice -- Introduction
- MySql的DDL和DML和DQL的基本语法
- At 12 o'clock on July 23, 2022, the deviation from the top of the line of love life hour appeared, maintaining a downward trend and waiting for the rebound signal.
- 一时跳槽一时爽,一直跳槽一直爽?
- SQLite database
猜你喜欢
随机推荐
第三届SLAM技术论坛-吴毅红教授
Now I don't know how to synchronize at all
Microservice architecture vs single service architecture [what can Huawei cloud service do in the microservice mode]
如何在面试中介绍自己的项目经验
Junior intern, ByteDance, after sharing, has been offered
Understanding of signals
C——文件
2022.7.22 JS object
The common interfaces of Alipay are uniformly encapsulated and can be used directly for payment parameters (applicable to H5, PC, APP)
SQLite数据库
数据库压力测试方法小结
Synchro esp32c3 Hardware Configuration Information serial port Print Output
1309_STM32F103上增加GPIO的翻转并用FreeRTOS调度测试
Modular development
集群聊天服务器:chatService业务层
LeetCode热题 HOT52-100
LU_ Asr01 voice module usage
TCP半连接队列和全连接队列(史上最全)
Problems and abuse of protocol buffers
221. 最大正方形 ●● & 1277. 统计全为 1 的正方形子矩阵 ●●









