美文网首页
MySQL: index:索引

MySQL: index:索引

作者: BenjaminCool | 来源:发表于2018-12-05 17:46 被阅读1次

innoDB indexes

https://dev.mysql.com/doc/refman/5.7/en/innodb-indexes.html

B-tree index & hash index

1. 演示了tree的查找、添加、删除过程

2. B-tree 动画演示

选择b-tree的原因:支持磁盘, 且访问磁盘数据时间复杂度为o(log(H))

https://en.wikipedia.org/wiki/B-tree

the B-tree is well suited for storage systems that read and write relatively large blocks of data, such as discs. It is commonly used in databasesand file systems.
b-tree 适合于存储系统,常被用于数据库和文件系统;

B-Tree is a self-balancing search tree. In most of the other self-balancing search trees (like AVL and Red-Black Trees), it is assumed that everything is in main memory. To understand the use of B-Trees, we must think of the huge amount of data that cannot fit in main memory. When the number of keys is high, the data is read from disk in the form of blocks. Disk access time is very high compared to main memory access time.
b-tree是个自平衡tree,

The main idea of using B-Trees is to reduce the number of disk accesses. Most of the tree operations (search, insert, delete, max, min, ..etc ) require O(h) disk accesses where h is the height of the tree. B-tree is a fat tree. The height of B-Trees is kept low by putting maximum possible keys in a B-Tree node.
使用 B-Tree的主要目的就是 以 o(log(h))的时间复杂度来 查找、删除、添加数据;b-tree结构的数据存放在磁盘上, 也就是以 0(log(H))的时间复杂度,在磁盘上获取数据;

Generally, a B-Tree node size is kept equal to the disk block size. Since h is low for B-Tree, total disk accesses for most of the operations are reduced significantly compared to balanced Binary Search Trees like AVL Tree, Red-Black Tree, ..etc.
B-Tree的深度h,相比于 AVL tree, Red-Black tree 来说较小, 进一步降低了 disk access(磁盘访问)次数;

相关文章

  • 7. Interview-MySQL

    1 MySQL索引类型? 普通索引,index 主键索引,primary 唯一索引,unique index 全文...

  • 索引(二)

    mysql索引的新手入门详解mysql索引之三:索引使用注意规则 索引(Index)是帮助 MySQL 高效获取数...

  • MySQL 索引分类

    MySQL索引的分类(根据数据结构) 索引的本质 MySQL官方对索引的定义为:索引(Index)是帮助MySQL...

  • mysql查询时强制或者禁止使用某个索引

    mysql强制索引和禁止某个索引 1、mysql强制使用索引:force index(索引名或者主键PRI)例如:...

  • Mysql 创建索引语句

    mysql有哪些索引 index 普通索引alter table table_name add index ind...

  • MySQL索引底层实现原理 & MyISAM非聚簇索引 vs.

    MySQL索引底层实现原理 MySQL官方对索引的定义为:索引(Index)是帮助MySQL高效获取数据的数据结构...

  • MySQL索引基础知识

    MySQL索引底层实现原理 MySQL官方对索引的定义为:索引(Index)是帮助MySQL高效获取数据的数据结构...

  • mysql索引简介

    索引是什么 mysql官方定义: 索引(index)是帮助mysql高效获取数据的数据结构。 所以索引的本质:索引...

  • mysql高级学习笔记

    什么是索引?索引(index) Mysql官方对索引的定义是:索引是帮助mysql高效获取数据的数据结构。所以, ...

  • MySql原理 - 索引

    1.索引 1.1 索引概述 MySQL官方对索引的定义:索引(index)是帮助MySQL高效获取数据的数据结构(...

网友评论

      本文标题:MySQL: index:索引

      本文链接:https://www.haomeiwen.com/subject/pnmwcqtx.html