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: Number of select operations performed. Only one value is added for one query.
• Com_insert: the number of INSERT operations performed. 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.