How to use MySQL profile
This article mainly explains "how to use MySQL profile". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use MySQL profile.
Parse a single query profile:
Mysql > show variables like'% prof%'
+-+ +
| | Variable_name | Value |
+-+ +
| | have_profiling | YES |
| | profiling | OFF |
| | profiling_history_size | 15 |
+-+ +
3 rows in set (0.00 sec)
Mysql > set profiling = 1
Query OK, 0 rows affected, 1 warning (0.00 sec)
Mysql > show variables like'% prof%'
+-+ +
| | Variable_name | Value |
+-+ +
| | have_profiling | YES |
| | profiling | ON |
| | profiling_history_size | 15 |
+-+ +
3 rows in set (0.00 sec)
Mysql > use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-A
Database changed
Mysql > select count (*) from user
+-+
| | count (*) |
+-+
| | 4 |
+-+
1 row in set (0.03 sec)
Mysql > show profiles
+-+
| | Query_ID | Duration | Query | |
+-+
| | 1 | 0.00103425 | show variables like'% prof%' |
| | 2 | 0.00016325 | SELECT DATABASE () |
| | 3 | 0.00049450 | show databases |
| | 4 | 0.00039775 | show tables |
| | 5 | 0.02702100 | select count (*) from user |
+-+
5 rows in set, 1 warning (0.00 sec)
Mysql > show profile for query 5
+-+ +
| | Status | Duration |
+-+ +
| | starting | 0.000090 | |
| | checking permissions | 0.000012 | |
| | Opening tables | 0.000030 | |
| | init | 0.000035 | |
| | System lock | 0.000016 | |
| | optimizing | 0.025417 | |
| | executing | 0.000054 | |
| | end | 0.000551 | |
| | query end | 0.000020 | |
| | closing tables | 0.000021 | |
| | freeing items | 0.000732 | |
| | cleaning up | 0.000045 | |
+-+ +
12 rows in set, 1 warning (0.00 sec)
At this point, I believe you have a deeper understanding of "how to use MySQL profile". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!