MySql SQL 優(yōu)化
通過 show [session|global]status 命令來查看服務器狀態(tài)信息挎春。
session -- 顯示 session(當期連接) 級統(tǒng)計結果
global -- 顯示 global(全局) 級統(tǒng)計結果
下面的命令顯示了當前 session 中所有統(tǒng)計參數(shù)的值:
mysql> show global status like 'Com_%';
+-----------------------------+---------+
| Variable_name | Value |
+-----------------------------+---------+
| Com_admin_commands | 14140 |
| Com_alter_db | 1 |
| Com_alter_table | 109 |
| Com_change_db | 1321 |
| Com_commit | 401428 |
| Com_create_db | 2 |
| Com_create_table | 95 |
| Com_delete | 751 |
| Com_drop_table | 100 |
| Com_empty_query | 2 |
| Com_insert | 282107 |
| Com_rollback | 18 |
| Com_select | 4173959 |
| Com_set_option | 3134324 |
| Com_show_charsets | 109 |
| Com_show_collations | 120 |
| Com_show_create_db | 7 |
| Com_show_create_func | 462 |
| Com_show_create_proc | 572 |
| Com_show_create_table | 17721 |
| Com_show_databases | 384 |
| Com_show_fields | 2747 |
| Com_show_function_status | 109 |
| Com_show_grants | 1 |
| Com_show_keys | 1814 |
| Com_show_procedure_status | 109 |
| Com_show_processlist | 58 |
| Com_show_status | 297 |
| Com_show_storage_engines | 125 |
| Com_show_table_status | 2342 |
| Com_show_tables | 1705 |
| Com_show_triggers | 423 |
| Com_show_variables | 407 |
| Com_show_warnings | 2196 |
| Com_stmt_execute | 56 |
| Com_stmt_close | 56 |
| Com_stmt_fetch | 0 |
| Com_stmt_prepare | 56 |
| Com_truncate | 4 |
| Com_update | 300711 |
+-----------------------------+---------+
147 行于數(shù)據(jù)集 (0.04 秒)