Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL 5.7Obtains the execution plan information that the specified thread is executing SQL

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

To get the execution plan information that the specified thread is executing SQL, you can use the following statement

When it takes a long time for a thread to execute SQL, you can use this statement to find the execution plan that is executing a large SQL, which is useful in performance diagnosis.

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)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report