Mysql update 行锁 释放

加锁

START TRANSACTION;
select * from T WHERE id = '640612854999511040' for update;
#commit;

查看 行锁

show engine innodb status;

=====================================
2021-09-07 21:01:04 0x7f35f88ba700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 59 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 9802 srv_active, 0 srv_shutdown, 86159 srv_idle
srv_master_thread log flush and writes: 95961
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 15950
OS WAIT ARRAY INFO: signal count 15981
RW-shared spins 0, rounds 31747, OS waits 15860
RW-excl spins 0, rounds 227, OS waits 1
RW-sx spins 0, rounds 0, OS waits 0
Spin rounds per wait: 31747.00 RW-shared, 227.00 RW-excl, 0.00 RW-sx
------------
TRANSACTIONS
------------
Trx id counter 2604960
Purge done for trx's n:o < 2604960 undo n:o < 0 state: running but idle
History list length 1
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421345527505872, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527499488, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527501312, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527498576, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527502224, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527504960, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527533232, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527532320, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527531408, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527512256, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527529584, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527528672, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527527760, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527526848, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527521376, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527525936, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527525024, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527524112, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527516816, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527523200, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527522288, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527520464, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527518640, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527507696, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527519552, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527517728, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527515904, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527514992, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527514080, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527513168, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527509520, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527511344, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527510432, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527500400, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527504048, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527508608, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421345527506784, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 2604948, ACTIVE 22 sec
2 lock struct(s), heap size 1136, 1 row lock(s)
MySQL thread id 1743, OS thread handle 139869779896064, query id 299835 61.144.172.148 root starting
show engine innodb status
--------
FILE I/O
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (write thread)
I/O thread 7 state: waiting for completed aio requests (write thread)
I/O thread 8 state: waiting for completed aio requests (write thread)
I/O thread 9 state: waiting for completed aio requests (write thread)
Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
 ibuf aio reads:, log i/o's:, sync i/o's:
Pending flushes (fsync) log: 0; buffer pool: 0
8266 OS file reads, 128597 OS file writes, 76104 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 1.86 writes/s, 0.75 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 3, seg size 5, 0 merges
merged operations:
 insert 0, delete mark 0, delete 0
discarded operations:
 insert 0, delete mark 0, delete 0
Hash table size 34673, node heap has 1 buffer(s)
Hash table size 34673, node heap has 1 buffer(s)
Hash table size 34673, node heap has 1 buffer(s)
Hash table size 34673, node heap has 4 buffer(s)
Hash table size 34673, node heap has 17 buffer(s)
Hash table size 34673, node heap has 0 buffer(s)
Hash table size 34673, node heap has 4 buffer(s)
Hash table size 34673, node heap has 5 buffer(s)
1.88 hash searches/s, 1.29 non-hash searches/s
---
LOG
---
Log sequence number 379863955
Log flushed up to   379863955
Pages flushed up to 379863701
Last checkpoint at  379863692
0 pending log flushes, 0 pending chkp writes
48743 log i/o's done, 0.44 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 137428992
Dictionary memory allocated 556953
Buffer pool size   8191
Free buffers       1024
Database pages     7134
Old database pages 2613
Modified db pages  3
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 1018, not young 42456
0.00 youngs/s, 0.00 non-youngs/s
Pages read 8162, created 2237, written 70870
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 7134, unzip_LRU len: 0
I/O sum[61]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Process ID=22776, Main thread ID=139870250751744, state: sleeping
Number of rows inserted 138821, updated 12601, deleted 20, read 632916705
0.81 inserts/s, 0.14 updates/s, 0.00 deletes/s, 39.32 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================

MySQL thread id 1743, OS thread handle 139869779896064, query id 299835 61.144.172.148 root starting
show engine innodb status

释放命令

kill connection 1743;

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值