mysql聚集索引 myisam_InnoDB使用的是聚集索引,MyISAM是非聚集索引,这种说法是否片面?...

一、首先,聚集索引和非聚集索引的根本区别是表记录的排列顺序和与索引的排列顺序是否一致。

因为聚集索引的完整数据记录(行数据,表记录)在叶子节点数据域,整个索引结构按照B+ Tree的结构有序(B+树数据结构性质决定),所以表记录的排列顺序和索引的排列顺序是一致的。

二、其次,MyISAM的索引方式也叫做“非聚集”的,之所以这么称呼是为了与InnoDB的聚集索引区分。

MyISAM的索引 有主索引和辅助索引,主索引和辅助索引的索引文件仅仅保存数据记录的地址,叶子节点data域是没有完整的数据记录的(行数据)。

InnoDB的索引 有主键索引和辅助索引,主键索引的叶子节点的data域保存了完整的数据记录(行数据);但是辅助索引的叶子节点却没有完整的数据记录(行数据),所以走辅助索引查找行数据会有一次回表的查询

关于聚集索引 辅助索引的概念和关系问题,官方文档里面有描述的:All indexes other than the clustered index are known as secondary indexes.15.6.2.1 Clustered and Secondary Indexes​dev.mysql.com

2. secondary index

A type of InnoDB index that represents a subset of table columns. An InnoDB table can have zero, one, or many secondary indexes. (Contrast with the clustered index, which is required for each InnoDB table, and stores the data for all the table columns.)

A secondary index can be used to satisfy queries that only require values from the indexed columns. For more complex queries, it can be used to identify the relevant rows in the table, which are then retrieved through lookups using the clustered index.https://dev.mysql.com/doc/refman/8.0/en/glossary.html#glos_secondary_index​dev.mysql.com

3. clustered index

The InnoDB term for a primary key index.https://dev.mysql.com/doc/refman/8.0/en/glossary.html#glos_clustered_index​dev.mysql.com

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值