• Bitmap Index


    Bitmap Index

    Bitmap index 的特点:
    1. 对于大数据量的查询,bitmap index 能更有效的减少响应时间
    2. 减少index的占用空间

    当查询语句的where 字句中包含多个column时, 位图索引最为有效. 因为在查询表之前, 那些有一个不符合所有column条件的row会直接被bitmap index 过滤掉.这样就大大减少了响应时间. 在多数情况下, 一般最好是针对单个column建立bitmap index 而不是组合索引.

    创建bitmap index的时候, 必须使用 nologging 和 compute statistics.而且, bitmap index 如果有问题, 最好是直接drop 然后重建而不是去想办法维护它.

    Cardinality  基数, 势的集
    每个column不同的值的个数叫基数. distinct value. bitmap index 非常适合建在基数比较小的column上, 比如说性别.而且如果说某个table里面有1000000条记录, 而某个column只有1000个不同的值, 相当于记录条数是0.1%. 这种情况下, 使用bitmap index也是不错的.

    对于具有唯一约束的或者是基数比较大的column, 比如ID, 最好用普通索引, 即b-tree index.

    对于fact table 和 dimension table, 可以在fact table中的外键上建立bitmap index.

    bitmap index 和 b-tree 另外一个最大的不同在于对NULL 的处理. bitmap index 可以处理null值, 而b-tree index 则无法存储NULL. 如果是bitmap index 的话, 你可以在where 字句中使用NULL, 如:
    select count(*) from customer where customer_long_name is null;
    此时, oracle 会使用customer_long_name 上的bitmap_index快速得到值, 甚至不用去真正的access table 上的数据.

    但是b-tree无法做到这点因为你无法在b-tree 上存储NULL值. 所以当你执行:
    select count(*) from customer 的时候, oracle 会自动从NOT NULL的字段上计算总数.

    在partitioned table 上, Bitmap index 只能是local index 而不能是global index.

  • 相关阅读:
    从泛型类中继承
    DataGridView中的单元格提示错误信息
    C#中的转换
    C#的运算符重载
    解决android模块化升级方法
    个人总结如何在项目管理的实际软件开发工作的几个关键点和控制
    bash no such file or directory in ubuntu 1404
    java 遍历树节点 同时保留所有的从根到叶节点的路径
    ZendFramework2学习笔记 json和ajax
    POJ 2531-Network Saboteur(DFS)
  • 原文地址:https://www.cnblogs.com/arcer/p/3202475.html
Copyright © 2020-2023  润新知