In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Mysql how to view the implementation plan, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
View the execution plan of mysql
The SQL runs for 4 minutes, and message_message has 1000W of data. Learn to write down the implementation plan of mysql.
Select * from message_message where id in (select message_id
From message_message_tags where messagetag_id=59885) and (category=9 or category=1)
Order by sum (like_count,favorite_count) desc limit 15; www.2cto.com
In the process of development, the performance is relatively poor with the increase of the amount of data, which extends to the slow response speed.
If the developer is likely to be at a loss most of the time, or leave it directly to DBA to deal with the problem, if you are lucky to have DBA
But if there is no DBA premise how to deal with this problem, perhaps the only way is to look at the implementation plan
(you can also directly use explain SQL to analyze.):
Profiling for Mysql is turned off by default, so profiling must be turned on first
Sql code
Set profiling= "ON"
> show variables like "profi%"
+-+ +
| | Variable_name | Value |
+-+ +
| | profiling | ON |
Www.2cto.com
Show processlist; looks at the list of all the processes running now. The only thing we need in the process list is ID.
Mysql > show processlist
+-
-+
| | Id | User | Host | db | Command | Time | State | Info |
| |
+-
-+
| | 3 | root | localhost:2196 | click_log | Query | 0 | NULL | show process |
List |
+-
Mysql > show profile cpu,memory for query 3
+-+
| | Status | Duration | CPU_user | CPU_system | |
+-+
| | freeing items | 0.00001375 | NULL | NULL | |
| | logging slow query | 0.00001375 | NULL | NULL | |
| | cleaning up | 0.00000050 | NULL | NULL | |
+-+
SHOW PROFILES Syntax:
SHOW PROFILE [type [, type]...]
[FOR QUERY n] www.2cto.com
[LIMIT row_count [OFFSET offset]]
Type:
ALL
| | BLOCK IO |
| | CONTEXT SWITCHES |
| | CPU |
| | IPC |
| | MEMORY |
| | PAGE FAULTS |
| | SOURCE |
| | SWAPS |
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.