獲取指定線程正在執(zhí)行SQL的執(zhí)行計劃信息,可以使用下面語句;當某個線程執(zhí)行SQL消耗了很長的時間,可以使用這個語句找到正在執(zhí)行大SQL的執(zhí)行計劃,在性能診斷上很有用。MySQL> show processlist;
+----+------+-----------+------+---------+------+--------------+----------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+------+---------+------+--------------+----------------------------------------------+
| 17 | root | localhost | NULL | Query | 0 | starting | show processlist |
| 18 | neo | localhost | fire | Query | 257 | Sending data | select count(*) from t1 join t2 on t1.a=t2.a |
+----+------+-----------+------+---------+------+--------------+----------------------------------------------+
2 rows in set (0.00 sec)
mysql>
EXPLAIN FOR CONNECTION 18;+----+-------------+-------+------------+-------+---------------+----------+---------+-----------+--------+----------+--------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+-------+------------+-------+---------------+----------+---------+-----------+--------+----------+--------------------------+
| 1 | SIMPLE | t1 | NULL | index | idx_t1_a | idx_t1_a | 5 | NULL | 392945 | 100.00 | Using where; Using index |
| 1 | SIMPLE | t2 | NULL | ref | idx_t2_a | idx_t2_a | 5 | fire.t1.a | 1 | 100.00 | Using index |
+----+-------------+-------+------------+-------+---------------+----------+---------+-----------+--------+----------+--------------------------+
2 rows in set (0.00 sec)
新聞名稱:MySQL5.7獲取指定線程正在執(zhí)行SQL的執(zhí)行計劃信息
URL鏈接:http://aaarwkj.com/article14/jposge.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導航、定制開發(fā)、企業(yè)網(wǎng)站制作、微信公眾號、面包屑導航、
廣告
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源:
創(chuàng)新互聯(lián)