Mysql show index解释

本文详细介绍了如何使用MySQL的SHOW INDEX命令来查看表上的索引状态,包括非唯一性、索引名称、列顺序等关键字段,并解释了这些字段的具体含义及其在数据库优化中的作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

查看表上的索引状态:


SHOW INDEX returns table index information.


SHOW KEYS and SHOW INDEXES are synonyms for SHOW INDEX.


语法:


show {index|indexes} from table_name [ from db_name ] [where expr]


The following fields are returned by SHOW INDEX.


FieldDescription
TableTable name
Non_unique 1 if the index permits duplicate values, 0 if values must be unique.
Key_nameIndex name. The primary key is always named PRIMARY.
Seq_in_indexThe column's sequence in the index, beginning with 1.
Column_nameColumn name.
CollationEither A, if the column is sorted in ascending order in the index, or NULL if it's not sorted.
CardinalityEstimated number of unique values in the index. The cardinality statistics are calculated at various times, and can help the optimizer make improved decisions.
Sub_part NULL if the entire column is included in the index, or the number of included characters if not.
Packed NULL if the index is not packed, otherwise how the index is packed.
Null NULL if NULL values are permitted in the column, an empty string if NULL's are not permitted.
Index_typeThe index type, which can be BTREEFULLTEXTHASH or RTREE. See Storage Engine Index Types.
CommentOther information, such as whether the index is disabled.
Index_commentContents of the COMMENT attribute when the index was created.


本文转自 wangergui 51CTO博客,原文链接:http://blog.51cto.com/wangergui/2074486,如需转载请自行联系原作者

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值