InnoDB索引页的物理结构

In On learning InnoDB: A journey to the core, I introduced the innodb_diagrams project to document the InnoDB internals, which provides the diagrams used in this post. (Note that each image below is linked to a higher resolution version of the same image.)

On learning InnoDB: A journey to the core中,我介绍了innodb_diagrams项目来记录InnoDB内部结构,该项目提供了本文中使用的图表。(请注意,下面的每个图像都链接到相同图像的更高分辨率版本。)

The basic structure of the space and each page was described in The basics of InnoDB space file layout, and we’ll now take a deeper look into how INDEX pages are physically structured. This will lay the ground work to discuss indexes at a logical (and much higher) level.

空间和每个页面的基本结构在InnoDB空间文件布局基础知识中已经描述过,现在我们将更深入地了解INDEX页面的物理结构。这将为讨论逻辑索引(以及更高级别的内容)奠定基础。

Everything is an index in InnoDB

在InnoDB中,一切都是索引

Before diving into physical structures, it’s critical to understand that in InnoDB, everything is an index. What does that mean to the physical structure?

在深入研究物理结构之前,了解在InnoDB中,一切都是索引是至关重要的。那对于物理结构意味着什么?

  1. Every table has a primary key; if the CREATE TABLE does not specify one, the first non-NULL unique key is used, and failing that, a 48-bit hidden “Row ID” field is automatically added to the table structure and used as the primary key. Always add a primary key yourself. The hidden one is useless to you but still costs 6 bytes per row.
  2. 每个表都有一个主键;如果CREATE TABLE没有指定主键,则使用第一个非NULL的唯一键,如果没有,则自动向表结构中添加一个48位隐藏的“行ID”字段,并将其用作主键。始终自己添加一个主键。对于您来说,隐藏的主键是无用的,但每行仍然需要6个字节的空间。
  3. The “row data” (non-PRIMARY KEY fields) are stored in the PRIMARY KEY index structure, which is also called the “clustered key”. This index structure is keyed on the PRIMARY KEY fields, and the row data is the value attached to that key (as well as some extra fields for MVCC).
  4. “行数据”(非主键字段)存储在主键索引结构中,也称为“聚簇键”。该索引结构以主键字段为键,行数据是附加到该键的值(以及一些用于MVCC的额外字段)。
  5. Secondary keys are stored in an identical index structure, but they are keyed on the KEY fields, and the primary key value (PKV) is attached to that key.
  6. 辅助键存储在相同的索引结构中,但它们是基于KEY字段进行键控的,并且主键值(PKV)附加到该键上。

When discussing “indexes” in Inno...

开通本站会员,查看完整译文。

Home - Wiki
Copyright © 2011-2024 iteam. Current version is 2.129.0. UTC+08:00, 2024-07-05 07:24
浙ICP备14020137号-1 $Map of visitor$