General steps for MySQL to optimize SQL statements

Source: Internet
Author: User

First, we need to display the status of MySQL and the dynamic value of the server caused by a series of operations. We can only look at it to judge and cannot change it.

Show status; Session level.

The number of operations after this logon.

Show status like 'com _ insert'; show status like 'com _ select'; show status like 'com _ Update'; show status like 'com _ delete ';

 

It shows the number of times that the server is added, deleted, modified, and queried after the server is up.

Show global status;

Show global status like 'com _ insert'; show global status like 'com _ select'; show global status like 'com _ Update'; show global status like 'com _ delete ';

We recommend that you use the InnoDB engine instead of the MyISAM engine.

Show status like 'innodb _ rows %'

 

The number of connections is displayed. Whether you have successfully logged on or not, the last connection is counted:

Show status like 'ons ons %'

We need to enable the binary log and slow query:

 

 

Check whether slow query is Enabled:

Show status like '% slow_query_log %'

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.