当前位置:网站首页>MySQL summary
MySQL summary
2022-06-30 06:01:00 【Flower master】
1、mysql What are the indexes
primary key He has to be primary key Each table can have only one index
A normal index is also called a secondary index , Accelerated search
unique index :
primary key :primary key : Accelerated search + constraint ( Not empty and unique )
unique index :unique: Accelerated search + constraint ( only )
Joint index :
Follow the prefix principle
Full-text index :
When searching for a long article , The best effect .
2、 Clustered index and non clustered index
The difference between a clustered index and a nonclustered index is : Whether the leaf node stores a whole row of records
InnoDB The primary key uses a clustered index ,MyISAM Whether it's a primary key index , Whether the secondary index uses non clustered index .
3、innodb and myisam The difference between
innodb Support things ,myisam Do not support things
Cluster index , Nonclustered index
Row lock , Table locks
Full text indexing is not supported , Full-text index
InnoDB Support foreign keys , and MyISAM I won't support it
4、innodb Engine 4 Big characteristic
Insert buffer (insert buffer), The two time to write (double write), adaptive hash index (ahi), read-ahead (read ahead)
5、MySQL The principle and process of replication
Mainly depends on
6、 Characteristics of things acid
Atomicity (Atomicity, Or indivisibility )
Uniformity (Consistency)
Isolation, (Isolation)
persistence (Durability)
InnoDB The storage engine also provides two types of transaction logs :redo log( Redo log ) and undo log( Rollback log ). among redo log Used to ensure transaction persistence ;undo log Is the basis for atomicity and isolation of transactions .
7、 redo log And binlog
We know , stay MySQL There is still binlog( Binary log ) Write operations can also be recorded and used for data recovery , But they are fundamentally different :
(1) The effect is different :redo log Is used for crash recovery Of , Guarantee MySQL Downtime also does not affect persistence ;binlog Is used for point-in-time recovery Of , Ensure that the server can recover data based on time points , Besides binlog Also used for master-slave replication .
(2) Different levels :redo log yes InnoDB Storage engine implementation , and binlog yes MySQL The server layer of ( You can refer to the front of the article MySQL Introduction to logical architecture ) Realized , Support at the same time InnoDB And other storage engines .
(3) The content is different :redo log It's a physical log , Content is disk-based Page;binlog The content of is binary , according to binlog_format Parameter difference , It may be based on sql sentence 、 Based on the data itself or a mixture of the two .
(4) Different write times :binlog Write at transaction commit time ;redo log The write time is relatively multivariate :
As mentioned earlier : Called when a transaction commits fsync Yes redo log To brush plate ; This is the default policy , modify innodb_flush_log_at_trx_commit Parameters can change the policy , But the durability of the transaction will not be guaranteed .
Except when the transaction commits , There are other brush times : Such as master thread Swipe the disk once a second redo log etc. , The advantage is that it doesn't have to wait commit When the brush set ,commit The speed has been greatly accelerated .
8、 The transaction isolation
1、 Read uncommitted ( Dirty reading ) Uncommitted data read
2、 Read submitted ( It can't be read repeatedly ) What I read is the latest log,
3、 Repeatable ( Fantasy reading ) -- resolvent . The difference between unrepeatable reading and phantom reading can be popularly understood as : The first is that the data changed , The latter is that the number of rows of data has changed .( adopt
4、RR To solve the dirty read 、 It can't be read repeatedly 、 Illusory reading and so on , It uses MVCC:MVCC Full name Multi-Version Concurrency Control, Multiple versions of the concurrency control protocol .
9、mvcc
The solution is dirty reading 、 It can't be read repeatedly 、 The problem of unreal reading
gap and next_lock
10、B+ Trees
The underlying leaf node is a two-way linked list
11、mysql Optimize
configuration :
1、buffer_pool Try to 75%-80%
2、 Size the number of connections
3、 modify wait_timeout The default time for is from 8 Hours changed to 1 Hours
4、 More open cache than write , Otherwise, it is recommended to close
Design optimization :
Create table time , Available fields can be used tinyint Do not use int.
The more indexes you create, the better , When you consider creating an index, you also need to create .
In terms of use
Return only the required fields .
Do not use null, Does not occupy a space , It is no longer in the index range .
Less use like
A very referential address :
边栏推荐
- 数据读写:Unity中基于C#脚本实现数据读写功能
- Qt之QListView的简单使用(含源码+注释)
- 10-【istio】istio Sidecar
- English grammar_ Adjective / adverb Level 3 - superlative
- Simple use of qlistview of QT (including source code + comments)
- Attempt to redefine 'timeout' at line 2 solution
- Navigate back to fragmentpageradapter - & gt; Fragment is empty - navigating back to fragmentpageradapter - & gt; fragments are empty
- Sword finger offer 22 The penultimate node in the linked list
- MySQL 索引
- Leetcode search insert location
猜你喜欢

86. separate linked list

Solidy - fallback function - 2 trigger execution modes

Here comes the nearest chance to Ali

MySQL存储系统
![[road of system analyst] collection of wrong topics in Project Management Chapter](/img/8b/2908cd282f5e505efe5223b4c5ddbf.jpg)
[road of system analyst] collection of wrong topics in Project Management Chapter

CompletableFuture从了解到精通,你想知道的这里都有

Use of OpenCL thread algebra library viennacl

MySQL advanced (Advanced SQL statement)

Solitidy - fallback 回退函数 - 2种触发执行方式

Zibll子比主题V6.4.1wordpress 开心版源码下载_破解原版/直接使用/无需教程
随机推荐
【数据库】事务
MySQL advanced (Advanced SQL statement)
VLAN access mode
Leader: who can use redis expired monitoring to close orders and get out of here!
583. 两个字符串的删除操作-动态规划
Prototype and prototype chain in JS
Acwing winter vacation daily question 2022 punch in day 11
English grammar_ Adjective / adverb Level 3 - superlative
Solidy - fallback function - 2 trigger execution modes
[chestnut sugar GIS] global mapper - how to assign the elevation value of the grid to the point
[GPU] basic operation
How to automatically renew a token after it expires?
CompletableFuture从了解到精通,你想知道的这里都有
Solidity - 安全 - 重入攻击(Reentrancy)
Solidity - Security - reentrancy attack
Learning automation ppt
Sword finger offer 22 The penultimate node in the linked list
旋转标注工具roLabelImg
About modifying dual system default startup item settings
Today, Ali came out with 35K. It's really sandpaper that wiped my ass. it showed me my hand