索引定义

见识了索引的各种定义类比各种实现各种应用,你终于想找一个高度概括的抽象定义(可能看到过忘记了),而网上的一般概念是这样的:

索引定义_第1张图片

 

 

wf??

直到在mongodb的官方文档找到了一个满意的答案:

索引定义_第2张图片

 

 摘出来:

Indexes are special data structures [1] that store a small portion of the collection’s data set in an easy to traverse form. The index stores the value of a specific field or set of fields, ordered by the value of the field. The ordering of the index entries supports efficient equality matches and range-based query operations. In addition, MongoDB can return sorted results by using the ordering in the index.

翻译一下:

索引是特殊的数据结构[1],它以易于遍历的形式存储收藏集数据集的一小部分。 索引存储一个特定字段或一组字段的值,按该字段的值排序。 索引条目的排序支持有效的相等匹配和基于范围的查询操作。 另外,MongoDB可以通过使用索引中的顺序来返回排序的结果。

 

这个解释就比像“索引是一种像目录一样的数据结构”那种只可意会不可言传的解释来的精确。

 

至于数据集的一小部分怎么存储怎么排序的实现问题,这个外界重复的到挺多的,最常用的就是MySQL实现使用的b+树,balabala...

你可能感兴趣的:(索引定义)