Show index from TABLE_NAME
This command helps diagnose poorly performing queries, especially if the query uses an available index.
The following describes the meaning of the result column that this command displays:
| Table | Non_unique | Key_name | Seq_in_index | column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
1.Table
The name of the table.
2.non_unique
0 if the index cannot include a repeating word. 1 if it is possible.
3.key_name
The name of the index.
4.seq_in_index
The column sequence number in the index, starting at 1.
5.column_name
The column name.
6.Collation
The column is stored in the index in what way. In MySQL, there is a value of ' A ' (ascending) or null (no classification).
7.Cardinality
An estimate of the number of unique values in the index. You can update by running analyze table or myisamchk-a. The cardinality is counted according to the statistics stored as integers, so even for small tables, this value is not necessarily accurate. The larger the cardinality, the greater the chance that MySQL will use the index when it is federated.
8.sub_part
The number of characters that are indexed if the column is only partially indexed. Null if the entire column is indexed.
9.Packed
Indicates how the keyword is compressed. Null if it is not compressed.
10.Null
If the column contains null, it contains Yes. If not, the column contains No.
11.index_type
Used indexed methods (BTREE, Fulltext, HASH, RTREE).
12.Comment
Various commentaries.
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/9E/5E/wKioL1mRH_yCUHDvAAQ3f83vzi4315.png "title=" Dfe280d9-5d3a-427c-ae3d-92d7c0fb73bc.png "alt=" Wkiol1mrh_ycuhdvaaq3f83vzi4315.png "/>
The above SQL is a full table scan because the primary key index is the ID, but there is no ID condition after the WHERE condition
Workaround:
1, optimizing SQL forecast
2, can be indexed on the Space_key
The meaning of the columns in the show index from Tb_name command in MySQL