1. Use the Show session status like '%com_%'; You can view the execution frequency of each SQL currently connected show global status like '%com_%'; You can see how often SQL has been executed since the last time MySQL server was booted up to date2. ExplainSelect * fromtmp; MySQL>ExplainSelect * fromZi_empwhereTid= +\g*************************** 1. Row***************************ID:1Select_type:simpleTable: zi_emp Type: AllPossible_keys:NULL Key:NULLKey_len:NULLRef:NULLrows:2extra:usingwhere 1Rowinch Set(0.00sec) Ps::type type, all is the least efficient because it means a full table scan index type is indexed full scan range for index range Scan ref for non-unique index or unique index prefix scan eq_ref unique index Scan Const/there is only one matching row in the System single table, such as a user tableNULLNo access to tables or indexes such as:Select 1=1;3. Haha, find a good thing explain extendedSelect * fromZi_emp; Before looking at the Execute SQL statement, the MySQL optimizer did something about show warnings; MySQL>Show Warnings\g*************************** 1. Row*************************** Level: note Code:1003Message:Select' Bin '. ' zi_emp '. ' Tid ' as' Tid ', ' bin '. ' zi_emp '. ' Tname ' as' Tname ' from' bin '. ' Zi_emp '1Rowinch Set(0.00sec) PS: Yes, you are looking at a complete SQL statement, which means that this is probably the best SQL statement given by MSYQL, which can be learned and reused4. Explain partitionsSelect * fromZi_empwhereXXXXX can see where the current record's partition is located