当前位置:网站首页>MySQL transaction isolation level experiment
MySQL transaction isolation level experiment
2022-06-13 03:18:00 【flyweight_ visitor】
Quick start
command
- Connect to database
mysql -uroot -p
mysql> use testdb
- Prepare the data
mysql> CREATE TABLE child (id int(11) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
mysql> INSERT INTO child (id) values (90),(102);
- View the current database isolation level
SELECT @@global.tx_isolation;

set global transaction isolation level read committed;
set global transaction isolation level repeatable read;
- conversation 1
mysql> START TRANSACTION;
mysql> SELECT * FROM child WHERE id > 100 FOR UPDATE;
- Conversation two
mysql> START TRANSACTION;
mysql> INSERT INTO child (id) VALUES (101);
- Conversation 3 ( View lock wait )
SELECT waiting_trx_id, waiting_pid, waiting_query, blocking_trx_id, blocking_pid, blocking_query FROM sys.innodb_lock_waits;

SELECT
r.trx_id waiting_trx_id,
r.trx_mysql_thread_id waiting_thread,
r.trx_query waiting_query,
b.trx_id blocking_trx_id,
b.trx_mysql_thread_id blocking_thread,
b.trx_query blocking_query
FROM information_schema.innodb_lock_waits w
INNER JOIN information_schema.innodb_trx b
ON b.trx_id = w.blocking_trx_id
INNER JOIN information_schema.innodb_trx r
ON r.trx_id = w.requesting_trx_id;
- conversation 1
mysql> SELECT * FROM child WHERE id > 100 FOR UPDATE;

mysql> SELECT * FROM child WHERE id > 100;

8. conversation 3
mysql> SELECT trx_id, trx_state, trx_started, trx_wait_started, trx_mysql_thread_id, trx_rows_locked, trx_isolation_level FROM information_schema.innodb_trx;

mysql> SELECT * FROM information_schema.innodb_locks;

mysql> SELECT * FROM information_schema.innodb_lock_waits;

mysql> SHOW ENGINE INNODB STATUS;

Reference material
边栏推荐
- 2022 qianle micro cloud technology learning task plan
- 【pytorch 记录】pytorch的变量parameter、buffer。self.register_buffer()、self.register_parameter()
- Wechat applet coordinate location interface usage (II) map interface
- Summary of the latest IOS interview questions in June 2020 (answers)
- Three ways to start WPF project
- The extra money we made in those years
- Differences between XAML and XML
- QML connecting to MySQL database
- Level II C test skills
- 视频播放屡破1000W+,在快手如何利用二次元打造爆款
猜你喜欢

Summary of rust language practice
![[JVM Series 5] performance testing tool](/img/94/b9a93fc21caacaf2a2e6421574de5c.jpg)
[JVM Series 5] performance testing tool

Flutter reports an error type 'Int' is not a subtype of type 'string' wonderful experience

Mvcc and bufferpool (VI)

When the flutter runs the project, the gradle download fails, and the running gradle task 'assemblydebug' is always displayed

C # simple understanding - method overloading and rewriting
![[JVM Series 7] garbage collector](/img/e5/902de6398359b75183aa1fafcaa7d1.jpg)
[JVM Series 7] garbage collector

Age anxiety? How to view the 35 year old programmer career crisis?

【pytorch 记录】pytorch的变量parameter、buffer。self.register_buffer()、self.register_parameter()

Summary of the latest IOS interview questions in June 2020 (answers)
随机推荐
Array in PHP array function_ Slice and array_ flip
How to manage the IT R & D department?
MySQL transactions and locks (V)
JMeter quick start
The use of curl in PHP
Linked list: reverse linked list
Linked list: orderly circular linked list
2019 - sorting out the latest and most comprehensive IOS test questions (including framework and algorithm questions)
2022.05.29
Stack: daily temperature
Mvcc and bufferpool (VI)
[synchronization function] version 2.0.16-19 has the update of synchronization function repair, but the problem has not been solved
Wechat applet obtains the current location (startlocationupdate, onlocationchange, offlocationchange)
Code d'initialisation de l'arbre binaire
Es and kibana deployment and setup
[JVM series 8] overview of JVM knowledge points
Operating principle of JS core EventLoop
C method parameter: ref
JVM class loader (2)
【 enregistrement pytorch】 paramètre et tampon des variables pytorch. Self. Register Buffer (), self. Register Paramètre ()