Lender Www en Mortgage eroesearcho Cash t Lenderhomemortgage asearche Www Fast Loans (
Szh searchn Fast o
rsearchg Home t Home
Innodb 作为 MySQL 中使用最为广泛的 事务型存储引擎,不仅在事务实现数据版本控制方面和其他存储引擎有一定的区别,其数据结构也是以非常有特点的方式存储的。
每个Innodb表的数据其实可以说就是以一个树型(B-Tree)结构存储的,表的数据和主键(Primary Key)共同组成了一个索引结构,也就是我们常说的Innodb的Clustered Primary Key。在这个Clustered Primary Key中,Leaf Nodes其实就是实际的表记录,我们常规理解上的索引信息全部在Branch Nodes上面。
除了Clustered Primary Key之外的其他所有索引在Innodb中被称为Secondary Index。Secondary Index就和普通的B-Tree索引差不多了,只不过在Secondary Index的所有Leaf Nodes上面同时包含了所指向数据记录的主键信息,而不是直接指向数据记录的位置信息。
所以,在 Innodb 中,如果主键值占用存储空间较大的话,会直接影响整个存储 Innodb 表所需要的物理空间,同时也会直接影响到 Innodb 的查询性能。
下面是画的一张 Innodb 索引基本结构图,包括 Primary Key 和 Secondary Index 两种索引的比较。
根据pedia的说明,B-tree是所有的结点都存放数据,而不仅仅是叶结点的。/B-tree#Node_structures
而且这个页面里:doc/innodb_plugin-1.0/innodb-row-format.html 也有说到:The essential idea is that the nodes of the B-tree contain, for each primary key value (whether user-specified or generated or chosen by the system), the values of the remaining columns of the row as well as the key.
这里也没有说到叶结点。不过我没有看过源码,不知是否理解正确。
@xlambda
这里的B-Tree索引只是数据库索引结构中索引类型的统称,不要照搬数据结构的理论。实际上,各个数据库所实现的B-Tree都是有其自身特点的,而且实际上都可以称之为B+ Tree。
疑问:在这个Clustered Primary Key中,Leaf Nodes其实就是实际的表记录。那这样讲的话,表的索引文件会比表文件还大?
[...] 原文出自: Innodb 索引结构了解 – Innodb Index Structure 这篇 【Innodb 索引结构了解 – Innodb Index Structure】来自 alidba.net By sky [...]
Innodb 索引结构了解 - Innodb Index Structure
[...] 原文出自:Sky.Jian 朝阳的天 原文链接:Innodb 索引结构了解 – Innodb Index Structure [...]
OurMySQL
Innodb 索引结构了解 – Innodb Index Structure…
每个Innodb表的数据其实可以说就是以一个树型(B-Tree)结构存储的,表的数据和主键(Primary Key)共同组成了一个索引结构,也就是我们常说的Innodb的Clustered Primary Key。在这个Clustered Primary Key….
Sky.Jian 朝阳的天空 - MySQL & Oracle 数据库性能优化,数据库架构设计
[...] “Innodb 索引结构了解 – Innodb Index Structure” 的文章,这次再接着分析一下 MyISAM [...]
Alibaba DBA Team » Blog Archive » MyISAM 索引结构了解 - MyISAM Index Structure
[...] “Innodb 索引结构了解 – Innodb Index Structure” 的文章,这次再接着分析一下 MyISAM [...]
MyISAM 索引结构了解 - MyISAM Index Structure
oWww Lenderhomemortgage B Lender Home Mortgage Szh Fast Cash Loans Lender Home Mortgage » Innodb 索引结构了解 – Innodb Index Structure - Sky.Jian – i Sky000 - 简朝阳b n n Lender Home Mortgage d Mortgage Lender Home Mortgage Lender Home Mortgage bWww Lenderhomemortgage B Lender Home Mortgage Szh Fast Cash Loans Lender Home Mortgage » Innodb 索引结构了解 – Innodb Index Structure - Sky.Jian – i Sky000 - 简朝阳e Lender Home Mortgage