[MySQL]关于Com_状态

MySQL 5.5官方文档:

http://dev.mysql.com/doc/refman/5.5/en/server-status-variables.html#statvar_Com_xxx

Com_xxx

The Com_xxx statement counter variables indicate the number of times each xxx statement has been executed. There is one status variable for each type of statement. For example, Com_delete and Com_update count DELETE and UPDATEstatements, respectively. Com_delete_multi and Com_update_multi are similar but apply to DELETE and UPDATEstatements that use multiple-table syntax.

If a query result is returned from query cache, the server increments the Qcache_hits status variable, not Com_select. See Section 8.9.3.4, “Query Cache Status and Maintenance”.

All of the Com_stmt_xxx variables are increased even if a prepared statement argument is unknown or an error occurred during execution. In other words, their values correspond to the number of requests issued, not to the number of requests successfully completed.

The Com_stmt_xxx status variables are as follows:

  • Com_stmt_prepare

  • Com_stmt_execute

  • Com_stmt_fetch

  • Com_stmt_send_long_data

  • Com_stmt_reset

  • Com_stmt_close

Those variables stand for prepared statement commands. Their names refer to the COM_xxx command set used in the network layer. In other words, their values increase whenever prepared statement API calls such asmysql_stmt_prepare()mysql_stmt_execute(), and so forth are executed. However, Com_stmt_prepare,Com_stmt_execute and Com_stmt_close also increase for PREPAREEXECUTE, or DEALLOCATE PREPARE, respectively. Additionally, the values of the older statement counter variables Com_prepare_sqlCom_execute_sql, and Com_dealloc_sql increase for the PREPAREEXECUTE, and DEALLOCATE PREPARE statements.Com_stmt_fetch stands for the total number of network round-trips issued when fetching from cursors.

Com_stmt_reprepare indicates the number of times statements were automatically reprepared by the server after metadata changes to tables or views referred to by the statement. A reprepare operation incrementsCom_stmt_reprepare, and also Com_stmt_prepare.

COM_ 这个类别代表着所有 MySQL 所执行过的指令,通常与 MySQL protocol 相关。在正常的情况下,你会希望这个类别所占的比例越低越好,因为当这个数值很高的时候就表示 MySQL 正忙碌于无关紧要的事情上。

原文地址:https://www.cnblogs.com/Clisa/p/3462839.html