首先介绍一下索引的整体结构,再具体介绍一下其中B+树索引的一些特性
索引结构
数据存储:索引数据页头和与普通数据表页头一样的结构,占用24个字节,ItemIds占用4个字节;

每个索引entries结构为IndexTupleData+Bitmap+Value,其中IndexTupleData占8个字节,Bitmap占4个字节,Value占4字节,合计占用16个字节,数据结构如下:
typedef struct IndexTupleData {
ItemPointerData t_tid; /* reference TID to heap tuple */
/* ---------------
* t_info is laid out in the following fashion:
*
* 15th (high) bit: has nulls
* 14th bit: has var-width attributes
* 13th bit: AM-defined meaning
* 12-0 bit: size of tuple
* ---------------
*/
unsigned short t_info; /* various info about tuple */
} IndexTupleData; /* MORE DATA FOLLOWS AT END OF STRUCT */
typedef IndexTupleData* IndexTuple;
typedef struct IndexAttributeBitMapData {

博客先介绍索引整体结构,包括数据存储及索引entries结构。接着阐述B+树数据结构,如页面special结构存储内容、索引有序性保证方式。还给出B+树创建顺序,涉及多个函数调用,将索引元组构建为索引结构。
最低0.47元/天 解锁文章
377

被折叠的 条评论
为什么被折叠?



