1. <small id='tvWF4'></small><noframes id='tvWF4'>

      • <bdo id='tvWF4'></bdo><ul id='tvWF4'></ul>
      1. <legend id='tvWF4'><style id='tvWF4'><dir id='tvWF4'><q id='tvWF4'></q></dir></style></legend>
      2. <i id='tvWF4'><tr id='tvWF4'><dt id='tvWF4'><q id='tvWF4'><span id='tvWF4'><b id='tvWF4'><form id='tvWF4'><ins id='tvWF4'></ins><ul id='tvWF4'></ul><sub id='tvWF4'></sub></form><legend id='tvWF4'></legend><bdo id='tvWF4'><pre id='tvWF4'><center id='tvWF4'></center></pre></bdo></b><th id='tvWF4'></th></span></q></dt></tr></i><div id='tvWF4'><tfoot id='tvWF4'></tfoot><dl id='tvWF4'><fieldset id='tvWF4'></fieldset></dl></div>
      3. <tfoot id='tvWF4'></tfoot>

        B 树索引如何在 mysql 中工作

        how B-tree indexing works in mysql(B 树索引如何在 mysql 中工作)
          <bdo id='lRDkX'></bdo><ul id='lRDkX'></ul>

          1. <legend id='lRDkX'><style id='lRDkX'><dir id='lRDkX'><q id='lRDkX'></q></dir></style></legend>
              • <tfoot id='lRDkX'></tfoot>
                  <tbody id='lRDkX'></tbody>

                <small id='lRDkX'></small><noframes id='lRDkX'>

                • <i id='lRDkX'><tr id='lRDkX'><dt id='lRDkX'><q id='lRDkX'><span id='lRDkX'><b id='lRDkX'><form id='lRDkX'><ins id='lRDkX'></ins><ul id='lRDkX'></ul><sub id='lRDkX'></sub></form><legend id='lRDkX'></legend><bdo id='lRDkX'><pre id='lRDkX'><center id='lRDkX'></center></pre></bdo></b><th id='lRDkX'></th></span></q></dt></tr></i><div id='lRDkX'><tfoot id='lRDkX'></tfoot><dl id='lRDkX'><fieldset id='lRDkX'></fieldset></dl></div>
                  本文介绍了B 树索引如何在 mysql 中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当我为 mysql 中的表创建索引时,我看到 index_type 是 BTREE 类型.现在虽然我了解 btree(s),但我不太明白它如何存储索引以及数据库如何基于此搜索记录.

                  When I create an index for a table in mysql, I see that the index_type is type BTREE. Now although I understand about btree(s), I do not quiet understand how it stores the index and how the database searches the records based on this.

                  我的意思是,btree 非常适合数据库执行读取和写入大数据块,当我们为 Primary key 的列类型创建索引时,我的理解是,它创建了一棵树并根据根的值类型拆分根的值.

                  I mean, btree is excellent for databases to perform read and writes large blocks of data, when we create an index for column type of Primary key, what I understand is, it creates a tree and splitting the values for the root based on the value type of the root.

                  现在,它是只存储树下的主键 ID 还是与该主键关联的整个数据?

                  Now, does it store only the the primary key ID under the trees or the whole data associated with that primary key?

                  找到想要的主ID后,数据库如何提取记录?

                  After finding the wanted primary ID, how does the database extract the record?

                  推荐答案

                  数据库将索引值存储为 B-Tree 键,记录指针存储为 B-Tree 值.

                  The database stores the value indexed as a B-Tree key, and the record pointer as a B-Tree value.

                  每当您搜索包含某个索引列的某个值的记录时,引擎都会在 B-Tree 中定位包含该值的键,检索指向该记录的指针并获取该记录.

                  Whenever you search for a record holding a certain value of an indexed column, the engine locates the key holding this value in the B-Tree, retrieves the pointer to the record and fetches the record.

                  究竟什么是记录指针",取决于存储引擎.

                  What exactly is a "record pointer", depends on the storage engine.

                  • MyISAM中,记录指针是MYI文件中记录的偏移量.

                  • In MyISAM, the record pointer is an offset to the record in the MYI file.

                  InnoDB中,记录指针是PRIMARY KEY的值.

                  In InnoDB, the record pointer is the value of the PRIMARY KEY.

                  InnoDB中,表本身是一个B-Tree,带有一个PRIMARY KEY作为B-Tree> 键.这就是所谓的聚集索引"或索引组织表".在这种情况下,所有其他字段都存储为 B-Tree 值.

                  In InnoDB, the table itself is a B-Tree with a PRIMARY KEY as a B-Tree key. This is what called a "clustered index" or "index-organized table". In this case, all other fields are stored as a B-Tree value.

                  MyISAM中,记录的存储没有任何特殊的顺序.这称为堆存储".

                  In MyISAM, the records are stored without any special order. This is called "heap storage".

                  这篇关于B 树索引如何在 mysql 中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Set the variable result, from query(设置变量结果,来自查询)
                  What is dynamic SQL?(什么是动态 SQL?)
                  Mysql - How to quit/exit from stored procedure(Mysql - 如何退出/退出存储过程)
                  Does MySQL have time-based triggers?(MySQL 有基于时间的触发器吗?)
                  is it possible to call a sql script from a stored procedure in another sql script?(是否可以从另一个 sql 脚本中的存储过程调用 sql 脚本?)
                  Procedure to loop through comma separated string is not working(遍历逗号分隔字符串的过程不起作用)
                    <bdo id='gz2A2'></bdo><ul id='gz2A2'></ul>

                      <small id='gz2A2'></small><noframes id='gz2A2'>

                        <legend id='gz2A2'><style id='gz2A2'><dir id='gz2A2'><q id='gz2A2'></q></dir></style></legend><tfoot id='gz2A2'></tfoot>

                          <tbody id='gz2A2'></tbody>

                        • <i id='gz2A2'><tr id='gz2A2'><dt id='gz2A2'><q id='gz2A2'><span id='gz2A2'><b id='gz2A2'><form id='gz2A2'><ins id='gz2A2'></ins><ul id='gz2A2'></ul><sub id='gz2A2'></sub></form><legend id='gz2A2'></legend><bdo id='gz2A2'><pre id='gz2A2'><center id='gz2A2'></center></pre></bdo></b><th id='gz2A2'></th></span></q></dt></tr></i><div id='gz2A2'><tfoot id='gz2A2'></tfoot><dl id='gz2A2'><fieldset id='gz2A2'></fieldset></dl></div>