Comments (1)
在mysql索引详解一文中提及聚簇索引和非聚簇索引的定义:
- 聚簇索引(Clustered Index)即索引结构和数据一起存放的索引,并不是一种单独的索引类型。InnoDB 中的主键索引就属于聚簇索引。
- 非聚簇索引(Non-Clustered Index)即索引结构和数据分开存放的索引,并不是一种单独的索引类型。二级索引(辅助索引)就属于非聚簇索引。MySQL 的 MyISAM 引擎,不管主键还是非主键,使用的都是非聚簇索引。
若只针对mysql而言是合理的,但此处应该是不考虑具体数据库,更宽泛的关于聚簇索引和非聚簇索引的定义。聚簇索引应为索引中数据项(data entry)的顺序与实际磁盘中数据(data record)存放的顺序相同(或相近)的索引,非聚簇索引反之。也就是说索引中数据页并不一定要存放完整的数据(data record),可以是真实数据地址。恰好mysql会创建一个包含完整数据的主键索引,所以唯一的聚簇索引就是和数据一起存放的索引。但实质上聚簇索引的定义与所谓索引结构和数据是否一起存放无关。我翻看了两本比较权威的数据库教材:
If the file containing the records is sequentially ordered, a clustering index is an index whose search key also defines the sequential order of the file. Clustering indices are also called primary indices; the term primary index may appear to denote an index on a primary key, but such indices can in fact be built on any search key. The search key of a clustering index is often the primary key, although that is not necessarily so. Indices whose search key specifies an order different from the sequential order of the file are called nonclustering indices, or secondary indices. The terms “clustered” and “nonclustered” are often used in place of “clustering” and “nonclustering.” - Database System Concepts (SILBERSCHATZ)
When a file is organized so that the ordering of data records is the same as or close to the ordering of data entries in some index, we say that the index is clustered; otherwise, it clustered is an unclustered index. - Database Management Systems (Ramakrishnan)
嗯嗯,这里确实主要针对的是 MySQL 数据库。你可以提交一个PR补充完善一下。
from javaguide.
Related Issues (20)
- 「Java内存区域详解(重点)」 文档的「方法区」部分描述好像有误 HOT 1
- LinkedHashMap实现LRU部分勘误
- 关于Mysql三大日志详解--undo-log描述不够具体 HOT 2
- Java集合概览部分多写了一个map HOT 1
- Firefox移动端页面返回到顶部按钮不会跟随页面阅读多少变化 HOT 1
- 死信队列这里的介绍语句 HOT 2
- 索引下推里例子的月份写错了 HOT 2
- Mongodb使用b+树,为什么放一篇b树的论证链接? HOT 1
- Java NIO 核心知识总结文章-个别图片背景是透明的,导致深色模式看不清字 HOT 1
- 构造方法用synchronized关键词修饰解释有误 HOT 1
- 关于线程等待和阻塞两种状态 HOT 1
- 双亲委派模型举例不严谨 HOT 1
- SQL语句中having的执行顺序是在select之前吧 HOT 2
- jdk1.7起,静态变量是位于堆区,而不是方法区
- 内容不严谨,复杂度错误 HOT 1
- SPI机制的设计思路和使用场景没有讲到核心
- 网站已经很久没有从此仓库更新 HOT 2
- HashMap 和 Hashtable 的区别补充
- 不推荐使用外键与级联原因的理解(对作者看法的其他意见) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javaguide.