zoukankan      html  css  js  c++  java
  • Oracle PLSQL

    Oracle :show explain plan

    select * from table(dbms_xplan.display);

    EXPLAIN PLAN FOR statements

    In fact, in a typical data warehouse environments, a bitmap index can be considered for any non-unique column.

       

    In a data warehouse, B-tree indexes should be used only for unique columns or other columns with very high cardinalities (that is, columns that are almost unique). The majority of indexes in a data warehouse should be bitmap indexes.

    One stage table, is a heap table, need always insert and delete, and we found it waste a lot of blocks.

    How to fix this issue?

    Use online –redefine.

    In sqlserver, we can just create a cluster index on this table, then drop this index, it will be ok.

    The following plsql is used to check the table's block used status: 

    Check table's used space percent:

    SELECT TABLE_NAME,HWM,AVG_USED_BLOCKS,
    
    GREATEST(ROUND(100 * (NVL(HWM - AVG_USED_BLOCKS,0)/GREATEST(NVL(HWM,1),1) ), 2), 0) WASTE_PER,sysdate analyze_dt
    
    from
    
    (SELECT A.BLOCKS - B.EMPTY_BLOCKS - 1 HWM,table_name,
    
    DECODE( ROUND((B.AVG_ROW_LEN * NUM_ROWS * (1 + (PCT_FREE/100)))/8192, 0),
    
    0, 1,
    
    ROUND((B.AVG_ROW_LEN * NUM_ROWS * (1 + (PCT_FREE/100)))/8192, 0)
    
    ) + 2 AVG_USED_BLOCKS
    
    FROM USER_SEGMENTS A,
    
    USER_TABLES B
    
    WHERE SEGMENT_NAME = TABLE_NAME
    
    and TABLE_NAME in ( SELECT TABLE_NAME FROM USER_TABLES WHERE TABLE_NAME LIKE 'XXX_%')
    
    and SEGMENT_TYPE = 'TABLE'
    
    )ORDER BY WASTE_PER DESC;

     

    Looking for a job working at Home about MSBI
  • 相关阅读:
    USB 描述符详细解析,来自老外网站,比协议描述清晰
    linux那些事儿之我是usb
    usb开源项目
    Quartus II 增量编译
    Quartus II 与 Modelsim 联调【转】
    Matlab语法
    RC上电复位时间计算
    Quartus 编译错误
    UltraEdit 所有快捷键 说明
    [转载]BT656/BT601/BT1120协议
  • 原文地址:https://www.cnblogs.com/huaxiaoyao/p/4227977.html
Copyright © 2011-2022 走看看