How to Understand the SQL Execution frequency

Source: Internet
Author: User
Tags mysql client

After the mysql client is successfully connected, you can use the show [session | Global] status command to provide server status information, or use the mysqladmin extended-STATUS Command on the operating system to obtain these messages.
Show [session | Global] status you can add the parameter "session" or "Global" as needed to display the session-level (current connection) statistics and global-level (since the last time the database was started). If this parameter is not specified, the default parameter "session" is used ".
Com_xxx indicates the number of times each XXX statement is executed. We usually care about the following statistical parameters:

  • Com_select: the number of select operations performed. Only 1 is added for one query.
  • Com_insert: the number of insert operations. insert operations in batches are accumulated only once.
  • Com_update: the number of times the update operation is performed.
  • Com_delete: the number of delete operations.

Knowing this information makes it easy for us to determine what storage engine we need. Generally, when there are many updates, InnoDB engine efficiency will be slightly higher!

The preceding parameters are used to accumulate table operations for all storage engines. The following parameters are only for the InnoDB Storage engine, and the tired algorithm is slightly different:

  • Innodb_rows_read: number of rows returned by the SELECT statement.
  • Innodb_rows_inserted: number of rows inserted by the insert operation.
  • Innodb_rows_updated: number of rows updated by the update operation.
  • Innodb_rows_deleted: number of rows deleted by the delete operation.

With the above parameters, you can easily understand whether the current database application is dominated by insert and update, query operations, and the approximate execution ratio of various types of SQL statements. The Count of update operations is the count of the number of executions. Both the commit and rollback operations are accumulated.
For transactional applications, you can use com_commit and com_rollback to learn about transaction commit and rollback. For databases with frequent rollback operations, it may mean that there is a problem in application writing.
In addition, the following parameters help us understand the basic information of the database:

  • Connections: number of attempts to connect to the MySQL server.
  • Uptime: the server's working time.
  • Slow_queries: the number of slow queries.

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.