zoukankan      html  css  js  c++  java
  • 我对PostgreSQL 中 Bitmap Heap scan 与 Bitmap Index scan 的学习

    开始

    我个人的理解,当 where 条件出现 or 或者 and 之类,有可能产生这种状况:

    postgres=#  explain analyze select id,deptno from gaotab where id=100 or id=300;
                                                             QUERY PLAN                                                         
    ----------------------------------------------------------------------------------------------------------------------------
     Bitmap Heap Scan on gaotab  (cost=8.52..13.34 rows=2 width=8) (actual time=31.201..31.227 rows=2 loops=1)
       Recheck Cond: ((id = 100) OR (id = 300))
       ->  BitmapOr  (cost=8.52..8.52 rows=2 width=0) (actual time=13.738..13.738 rows=0 loops=1)
             ->  Bitmap Index Scan on idx_id_dept  (cost=0.00..4.26 rows=1 width=0) (actual time=13.729..13.729 rows=1 loops=1)
                   Index Cond: (id = 100)
             ->  Bitmap Index Scan on idx_id_dept  (cost=0.00..4.26 rows=1 width=0) (actual time=0.008..0.008 rows=1 loops=1)
                   Index Cond: (id = 300)
     Total runtime: 42.876 ms
    (8 rows)
    
    postgres=# 

    就是说,bitmap index scan 就相当于  index scan。只是它们需要组合起结果来,所以被称为  Bitmap Index Scan。

    Bitmap Index Scan 的结果组合起来,就是 Bitmap Heap Scan(可能涉及排序等)。

    [作者:技术者高健@博客园  mail: luckyjackgao@gmail.com ]

    结束

  • 相关阅读:
    接口和抽象的区别
    继承-子父类中成员方法特点
    基本类型和引用类型作为参数传递
    大三寒假生活6
    大三寒假生活5
    大三寒假生活4
    大三寒假生活3
    大三寒假生活2
    大三寒假生活指导
    ajax实现文本框的联想功能
  • 原文地址:https://www.cnblogs.com/gaojian/p/2759199.html
Copyright © 2011-2022 走看看