当前位置:网站首页>面试突击56:聚簇索引和非聚簇索引有什么区别?
面试突击56:聚簇索引和非聚簇索引有什么区别?
2022-06-13 12:05:00 【InfoQ】
聚簇索引
drop table if exists student;
create table student(
id int primary key,
name varchar(16),
class_id int not null,
index (class_id)
)engine=InnoDB;
-- 添加测试数据
insert into student(id,name,class_id) values(1,'张三',100),
(2,'李四',200),(3,'王五',300);

非聚簇索引

总结
- 聚簇索引叶子节点存储的是行数据;而非聚簇索引叶子节点存储的是聚簇索引(通常是主键 ID)。
- 聚簇索引查询效率更高,而非聚簇索引需要进行回表查询,因此性能不如聚簇索引。
- 聚簇索引一般为主键索引,而主键一个表中只能有一个,因此聚簇索引一个表中也只能有一个,而非聚簇索引则没有数量上的限制。
边栏推荐
- 查询当前电脑cpu核心数
- [tcaplusdb knowledge base] Introduction to tcaplusdb tcapulogmgr tool (I)
- 我和指针那些事——初识指针
- 【管理知多少】“风险登记册”本身的风险
- 2022.2:EyeshotPro EyeshotUltimate EyeshotFem
- break algorithm---dynamic planning(dp-arr)
- [benefits] in minutes
- 以梦为马之89c51单片机驱动lcd
- 2022.2:EyeshotPro EyeshotUltimate EyeshotFem
- Lvgl Library Tutorial 01- porting to STM32 (touch screen)
猜你喜欢
![[tcapulusdb knowledge base] Introduction to tcapulusdb table data caching](/img/8b/96ecf2d9c97b3dd2cabe5ca68c3414.png)
[tcapulusdb knowledge base] Introduction to tcapulusdb table data caching

Mac MySQL installation tutorial

秒云与趋动科技联合发布容器云平台与GPU资源池化整体解决方案

【TcaplusDB知识库】TcaplusDB表数据缓写介绍

Interview shock 56: what is the difference between clustered index and non clustered index?

【TcaplusDB知识库】TcaplusDB-tcapulogmgr工具介绍(二)
![[truth] the reason why big factories are not afraid to spend money is...](/img/db/6d40acbb0a28e9ead029f29e0ec0b3.png)
[truth] the reason why big factories are not afraid to spend money is...
![[benefits] in minutes](/img/e0/217fe575c1a31b04a9b0699ec44f25.png)
[benefits] in minutes

MCDF Experiment 2

Lightweight real-time semantic segmentation: eNet & erfnet
随机推荐
The industry-leading interface component package devaxpress officially released v21.2.8 in June
查询当前电脑cpu核心数
Process of manually encrypting and burning the mass production firmware of ESP equipment
2022.2:EyeshotPro EyeshotUltimate EyeshotFem
Pulsar 生产者
2022.2:EyeshotPro EyeshotUltimate EyeshotFem
Base du Shell - 30, utilisation de la commande sed
The most complete network, including interview questions + Answers
自己炒股怎么开户?安全可靠吗?
北京市场监管局启动9类重点产品质量专项整治工作
break algorithm---dynamic planning(dp-arr)
camunda如何使用script脚本节点
LVGL库入门教程01-移植到STM32(触摸屏)
Fuel scheme and product business modeling
TS进阶之keyof
How camunda uses script script nodes
Kubernetes问题整理
kubernetes 部署 ActiveMQ
[tcaplusdb knowledge base] Introduction to tcaplusdb tcaplusadmin tool
Based on STM32F103 - DS1302 date time + serial port printing