zoukankan      html  css  js  c++  java
  • OCP-1Z0-052-V8.02-171题

    171. View the Exhibit and examine the command used to create the ZONEDATA table.

    The table contains a million rows for zonewise analysis in the DSS system. DML operations are

    performed very rarely on the table. You decide to prepare an index on the ZONE column to enhance the

    performance of the queries on the ZONE column.

    Which type of index would you select in this scenario?

    A.Bitmap index

    B.Reverse key index

    C.Normal B-Tree index

    D.Function-based index

    Answer: A

    答案解析:

    此题考的对于上表的zone列用哪种索引较好

    zone的值只有四个 ,基数少,故用位图索引较好。

    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.

  • 相关阅读:
    cordova windows环境配置
    javascript 变量声明 和 作用域
    javascript 数组总结
    处理事件的兼容写法
    javascript 闭包
    事件委托和事件绑定
    依赖注入
    .Net委托
    sql游标循环结果集
    T-Sql之集合
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13317156.html
Copyright © 2011-2022 走看看