Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the columns of show index from tb_name command in mysql

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Let's talk about what are the show index from tb_name command columns in mysql. The secret of the text is that it is relevant to the topic. So, no gossip, let's go straight to the following, I believe you will benefit from reading this article on what is the show index from tb_name command in mysql.

Show index from table_name

This command helps diagnose low-performance queries, especially if the query uses an available index.

The following describes the meaning of the result column displayed by this command:

| | 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 duplicate words. 1, if 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

Column name.

6.Collation

How the column is stored in the index. In MySQL, there is a value of'A'(ascending order) or NULL (no classification).

7.Cardinality

An estimate of the number of unique values in the index. It can be updated by running ANALYZE TABLE or myisamchk-a. The cardinality is counted based on statistics stored as integers, so even for small tables, the value does not need to be accurate. The higher the cardinality, the greater the chance that mysql will use the index when federating.

8.Sub_part

If the column is only partially indexed, the number of characters indexed. NULL if the entire column is indexed.

9.Packed

Indicates how keywords are 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 index methods (BTREE, FULLTEXT, HASH, RTREE).

12.Comment

Multiple commentaries.

The sql above is a full table scan because the primary key index is ID, but there is no id condition after the where condition

Solution:

1. Optimize sql prediction

2, which can be indexed on SPACE_KEY

Is there anything you don't understand about what are the columns of show index from tb_name commands in the above mysql? Or if you want to know more about it, you can continue to follow our industry information section.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report