Common test points of MySQL database


1、ACID

image-20230201110516214

business principle

image-20230201183115209

transaction persistence

image-20230201184355749

transaction atomicity

image-20230201184847275

Basic concepts of MVCC

image-20230201185341645

Fundamentals of MVCC

image-20230201185547843

undo log

image-20230201193124540

undo log version chain

image-20230201193916668

readview

image-20230201195741866

MVCC implementation principle

image-20230201200202115

RC read committed

image-20230201201859451

RR repeatable read

image-20230201202757006

MVCC implementation principle

image-20230201202953875

Summarize

image-20230201203504311

2. Problems caused by concurrent transactions

image-20230201111810443

3. Transaction isolation level

image-20230201112426384

Note : The higher the transaction isolation level, the more secure the data, but the lower the performance

image-20230201114502158

4. Index

4.1. Index overview

image-20230201121618812

4.2. Advantages and disadvantages of indexing

image-20230201121723698

4.3. Index structure

binary tree

image-20230201122729877

B-Tree tree

image-20230201124016293

B+Tree tree

image-20230201125911225

B+Tree optimization

image-20230201130137365

Hash index

image-20230201155613366

Features of Hash Index

image-20230201160329135

interview questions

image-20230201161040465

index classification

image-20230201162108409

image-20230201162309066

Clustered and Secondary Indexes

image-20230201162522169

return table query

image-20230201162713316

How high is the B+tree height of the InnoDB primary key index?

image-20230201163329831

index syntax

image-20230201164342554

slow query log

image-20230201170827235

SQL performance analysis

image-20230201171916941

explain execution plan

image-20230201175550239

image-20230201175947637

shared lock

Shared locks, also known as read locks, S locks. Going to the toilet is equivalent to modifying the operation. When a transaction adds a shared lock to a row, the row can only be read, not written. Other transactions can only add shared locks to it, not exclusive locks.

exclusive lock

Exclusive lock, also known as write lock, X lock. When an exclusive lock is added, it is equivalent to closing the door of the bathroom, and others cannot go in to wash hands, put on makeup, and the like. That is to say, write operations and read operations cannot be performed, and other transactions cannot lock it again.

Everyone's understanding of exclusive locks may be somewhat different. I made a mistake at the beginning, thinking that after an exclusive lock locks a row of data, other transactions cannot read and modify the row of data, but this is not the case. Exclusive lock means that after a transaction adds an exclusive lock to a row of data, other transactions cannot add other locks to it.

The mysql InnoDB engine defaults to modify the data statement, update, delete, insert will automatically add an exclusive lock to the data involved, the select statement will not add any lock type by default, if you add an exclusive lock, you can use the select ... for update statement to add sharing Locks can use the select ... lock in share mode statement.

so addedData rows with exclusive locks cannot be modified in other transactions, and data cannot be queried through for update and lock in share mode locks, but data can be queried directly through select...from..., because ordinary queries do not have any locking mechanism.

Guess you like

Origin blog.csdn.net/weixin_54040016/article/details/128841296