码迷,mamicode.com
首页 > 其他好文 > 详细

B-tree indexes

时间:2016-08-23 01:34:46      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:

High Performance MySQL, Third Edition
by Baron Schwartz, Peter Zaitsev, and Vadim Tkachenko

http://dev.mysql.com/doc/refman/5.7/en/

https://zh.wikipedia.org/wiki/ISAM

https://en.wikipedia.org/wiki/ISAM

 

ISAM (an acronym for Indexed Sequential Access Method) is a method for indexing data for fast retrieval.

索引顺序存取方法(ISAM, Indexed Sequential Access Method)最初是IBM公司发展起来的一个文件系统,可以连续地(按照他们进入的顺序)或者任意地(根据索引)记录任何访问。每个索引定义了一次不同排列的记录。现在这个概念用在许多场合:

  • 特指IBM公司的ISAM产品
  • 数据库系统中提供用户接口从数据文件中检索数据。
  • 通常指,数据库的索引,这种索引被大多数数据库所采用,包括关系数据库或其它。

在ISAM系统,数据组织成有固定长度的记录,按顺序存储的。

 

 

In an ISAM system, data is organized into records which are composed of fixed length fields. Records are stored sequentially, originally to speed access on a tape system. A secondary set of hash tables known as indexes contain "pointers" into the tables, allowing individual records to be retrieved without having to search the entire data set. This is a departure from the contemporaneous navigational databases, in which the pointers to other data were stored inside the records themselves. The key improvement in ISAM is that the indexes are small and can be searched quickly, thereby allowing the database to access only the records it needs. Additionally modifications to the data do not require changes to other data, only the table and indexes in question.

When an ISAM file is created, index nodes are fixed, and their pointers do not change during inserts and deletes that occur later (only content of leaf nodes change afterwards). As a consequence of this, if inserts to some leaf node exceed the node‘s capacity, new records are stored in overflow chains. If there are many more inserts than deletions from a table, these overflow chains can gradually become very large, and this affects the time required for retrieval of a record.[4]

 

Table 16.2 MyISAM Storage Engine Features

Storage limits 256TB Transactions No Locking granularity Table
MVCC No Geospatial data type support Yes Geospatial indexing support Yes
B-tree indexes Yes T-tree indexes No Hash indexes No
Full-text search indexes Yes Clustered indexes No Data caches No
Index caches Yes Compressed data Yes[a] Encrypted data[b] Yes
Cluster database support No Replication support[c] Yes Foreign key support No
Backup / point-in-time recovery[d] Yes Query cache support Yes Update statistics for data dictionary Yes

[a] Compressed MyISAM tables are supported only when using the compressed row format. Tables using the compressed row format with MyISAM are read only.

[b] Implemented in the server (via encryption functions). Data-at-rest tablespace encryption is available in MySQL 5.7 and higher.

[c] Implemented in the server, rather than in the storage engine.

[d] Implemented in the server, rather than in the storage engine.

 

Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type. An .frm file stores the table format. The data file has an .MYD (MYData) extension. The index file has an .MYI(MYIndex) extension.

Table 15.1 InnoDB Storage Engine Features

Storage limits 64TB Transactions Yes Locking granularity Row
MVCC Yes Geospatial data type support Yes Geospatial indexing support Yes[a]
B-tree indexes Yes T-tree indexes No Hash indexes No[b]
Full-text search indexes Yes[c] Clustered indexes Yes Data caches Yes
Index caches Yes Compressed data Yes[d] Encrypted data[e] Yes
Cluster database support No Replication support[f] Yes Foreign key support Yes
Backup / point-in-time recovery[g] Yes Query cache support Yes Update statistics for data dictionary Yes

[a] InnoDB support for geospatial indexing is available in MySQL 5.7.5 and higher.

[b] InnoDB utilizes hash indexes internally for its Adaptive Hash Index feature.

[c] InnoDB support for FULLTEXT indexes is available in MySQL 5.6.4 and higher.

[d] Compressed InnoDB tables require the InnoDB Barracuda file format.

[e] Implemented in the server (via encryption functions). Data-at-rest tablespace encryption is available in MySQL 5.7 and higher.

[f] Implemented in the server, rather than in the storage engine.

[g] Implemented in the server, rather than in the storage engine.

 

Storage engines use B-Tree indexes in various ways, which can affect performance. For instance, MyISAM uses a prefix compression technique that makes indexes smaller,but InnoDB leaves values uncompressed in its indexes. Also, MyISAM indexes refer to the indexed rows by their physical storage locations, but InnoDB refers to them by their primary key values. Each variation has benefits and drawbacks.
The general idea of a B-Tree is that all the values are stored in order, and each leaf page is the same distance from the root.
 

B-tree indexes

标签:

原文地址:http://www.cnblogs.com/yuanjiangw/p/5797772.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!