在OLTP系统使用索引组织表IOT

索引组织表IOT
原理:所有列都存储在索引段。不再使用物理rowid,而是使用逻辑rowid。
适用场景:列数较少,复合主键,访问主键为主。

创建:
create table cities
(
  city_id number(6) not null
  ,country_id number(6) not null
  ,city varchar2(25)
  ,country varchar2(25)
  ,constraint cities_pk primary key(city_id,country_id)
)
organization index
tablespace sh
pctthreshold 40
including country_id
overflow tablespace overflow_s;

上例中,
organization index 表示创建的是索引组织表;
pctthreshold 40 表示行的长度占索引块大小超过40%将放入溢出段,溢出段在表空间overflow_s。


查询相关视图

点击(此处)折叠或打开

  1. column table_name format a15
  2. column index_name format a15
    column index_type format a15
    column pct_threshold format 99.99
    column include_column format a35
    select i.table_name,i.index_name,i.index_type,i.pct_threshold,
     nvl(column_name,'NONE') include_column
    from user_indexes i left join user_tab_columns c
    on (i.table_name = c.table_name)
    and (i.include_column = c.column_id)
    where index_type like '%IOT%';


TABLE_NAME      INDEX_NAME      INDEX_TYPE      PCT_THRESHOLD
--------------- --------------- --------------- -------------
INCLUDE_COLUMN
-----------------------------------
CITIES          CITIES_PK       IOT - TOP               40.00
COUNTRY_ID


索引组织表也需要重建以保持访问性能。
请使用浏览器的分享功能分享到微信等