当前位置:网站首页>MySQL learning
MySQL learning
2022-07-01 06:33:00 【A small salted fish I】
List of articles
- sql Optimize
- The underlying implementation principle and optimization of index
- Binary tree 、 Balanced binary trees 、b Trees 、b+ Trees
- What are the principles for indexing data tables ?
- When is it not appropriate to build an index ?
- What is a lock ?
- What is stored procedure ? What to call ?
- Say yes SQL What are the methods of statement optimization ?( Choose a few )
sql Optimize
It's best to optimize in the following order :
1、SQL Statement and index optimization
2、 Database table structure optimization
3、 Optimization of system configuration
4、 Hardware optimization
details
The underlying implementation principle and optimization of index
B+ Trees , Optimized B+ Trees
It mainly adds a pointer to the next leaf node among all leaf nodes , therefore InnoDB build
It is recommended that most tables use the default self incrementing primary key as the primary index .
Binary tree 、 Balanced binary trees 、b Trees 、b+ Trees






B+ Trees , Optimized B+ Trees
It mainly adds a pointer to the next leaf node among all leaf nodes , therefore InnoDB build
It is recommended that most tables use the default self incrementing primary key as the primary index .
What are the principles for indexing data tables ?
In the most frequently used 、 To narrow the scope of the query to build an index on the field .
In frequent use 、 Index the fields that need to be sorted
When is it not appropriate to build an index ?
For the columns rarely involved in the query or the columns with more duplicate values , It's not good to index .
For some special data types , It's not good to index , For example, text field (text) etc.
What is a lock ?
answer : Database is a shared resource used by multiple users . When multiple users access data concurrently , In number
Multiple transactions access the same data at the same time in the database . If you do not control concurrent operations, you can
Can read and store incorrect data , Breaking database consistency .
Locking is a very important technology to realize database concurrency control . When a transaction is processing a data object
Before the operation , Make a request to the system first , Lock it . After locking, the transaction has a certain effect on the data object
The control of , Before the transaction releases the lock , Other transactions cannot update this data object .
Basic lock type : Locks include row level locks and table level locks
What is stored procedure ? What to call ?
answer : Stored procedure is a precompiled SQL sentence , The advantage is to allow modular design , That means just
To create a , Later in the program can be called many times . If an operation needs to be performed more than once SQL,
Using stored procedures is better than just SQL Statement execution should be fast . You can call a stored procedure with a command object
Say yes SQL What are the methods of statement optimization ?( Choose a few )
1、Where clause :where Connections between tables must be written in other Where Before condition , Those can be
The condition to filter out the maximum number of records must be written in Where End of clause .HAVING Last .
2、 use EXISTS replace IN、 use NOT EXISTS replace NOT IN. 3、 Avoid using calculations on index columns
4、 Avoid using... On index columns IS NULL and IS NOT NULL
5、 Optimize the query , Try to avoid full scan , The first thing to consider is where And order by Involve
Index the columns of and .
6、 Should try to avoid in where Field in the clause null Value judgement , Otherwise, it will cause the engine to give up
Full table scan using index
7、 Should try to avoid in where The clause performs an expression operation on the field , This will cause the engine to be abandoned
Index and scan the whole table
边栏推荐
猜你喜欢

【微信小程序】视图容器和基本内容组件

VS2019如何永久配置本地OpenCV4.5.5使用

软件工程复习
![[ITSM] what is ITSM and why does it department need ITSM](/img/e1/85b5f00f124829b6a6b40c5cf621bd.png)
[ITSM] what is ITSM and why does it department need ITSM

async 与 await

嵌入式系统
![[self use of advanced mathematics in postgraduate entrance examination] advanced mathematics Chapter 1 thinking map in basic stage](/img/54/f187e22ad69f3985d30376bad1fa03.png)
[self use of advanced mathematics in postgraduate entrance examination] advanced mathematics Chapter 1 thinking map in basic stage
![[unity shader ablation effect _ case sharing]](/img/e3/464f1cf426e8c03ce3d538ed9cf4bc.png)
[unity shader ablation effect _ case sharing]
![[postgraduate entrance examination advanced mathematics Wu Zhongxiang +880 version for personal use] advanced mathematics Chapter II Basic Stage mind map](/img/c0/299a406efea51f24b1701b66adc1e3.png)
[postgraduate entrance examination advanced mathematics Wu Zhongxiang +880 version for personal use] advanced mathematics Chapter II Basic Stage mind map

B-tree series
随机推荐
How did ManageEngine Zhuohao achieve the goal of being selected into Gartner Magic Quadrant for four consecutive years?
图片服务器项目测试
SystemVerilog learning-06-class encapsulation
Mysql 表分区创建方法
给逆序对数求原数组
Mongodb: I. what is mongodb? Advantages and disadvantages of mongodb
软件工程复习
idea 好用插件汇总!!!
Picture server project test
JMM details
mysql数据类型学习笔记
C语言课设职工信息管理系统(大作业)
SystemVerilog learning-07-class inheritance and package use
SystemVerilog learning-09-interprocess synchronization, communication and virtual methods
【#Unity Shader#Amplify Shader Editor(ASE)_第九篇】
On siem
PAT (Advanced Level) Practice 1057 Stack
Uniapp tree level selector
Chapitre V gestion des entrées / sorties
Functions of switch configuration software