bitmap heap scan

来源:互联网 发布:人工智能与人类智慧 编辑:程序博客网 时间:2024/05/22 10:00
6 "Bitmap Heap Scan" 解释
   A plain indexscan fetches one tuple-pointer at a time from the index,
and immediately visits that tuple in the table.  A bitmap scan fetches
all the tuple-pointers from the index in one go, sorts them using an
in-memory "bitmap" data structure, and then visits the table tuples in
physical tuple-location order.  The bitmap scan improves locality of
reference to the table at the cost of more bookkeeping overhead to
manage the "bitmap" data structure --- and at the cost that the data
is no longer retrieved in index order, which doesn't matter for your
query but would matter if you said ORDER BY.        

        上面的意思是说,普通的索引扫描( index scan) 一次只读一条索引项,那么
一个 PAGE面有可能被多次访问;而 bitmap scan 一次性将满足条件的索引项全部取

出,并在内存中进行排序, 然后根据取出的索引项访问表数据。

普通索引一次读取一条索引项,个人是这样理解  先读取索引建到内存比较 发现相等 则读取对应的实际 数据的指针(数据位置值)到内存 在根据这个指针读取数据

位图索引 一次读取所有的索引的指针值 (根据所有记录的0,1,0)

(扫描数据 不在按照索引顺序 而是按照 位图中为1 的顺序)

0 0
原创粉丝点击