术语表:heap table, RID, bookmark lookup,
leading edge (组合索引的前导列)
seek, scan , row locator
decision node, leaf node
covering index, index join, include column
若果表建了clustered index,non-clustered index的row locator是 表的clustered index 的key,也就是说,查完non-clustered index的 B+树,还要再查一遍 clustered index的B+树。这样做好处是当物理的数据页放生拆分等变化,不必更新non-clustered index,non-clustered index一般有很多个。
从名字理解聚集索引、非聚集索引。非聚集索引本身是排序连续的,但指向的data row是离散的,所以又叫bookmark lookup,所以叫非聚集。聚集索引本身是排序的,指向的 data row也是排序的连续的,是聚集的。
搜索/查询本质的还是scan和比较,索引的本质就是用一个在一个小规模的数据集(一个列)上的查找去定位原始数据,而且因为可以排序,可以用一些基于有序数据的高效的查找方法(b+树,二分等)即所谓的seek来代替线性的scan
覆盖索引,lucene,MDS的索引,都是索引本身包含数据,已经不再在需要最后去原始数据去找,或者说把原始数据抽取出来一部分(抽象成document)来支持查询服务。